i am having a issue on my osclass theme. I want to display a particular image from my folder manually. The images are in the folder and i am using this function to display the image, could someone help.
if(!function_exists('aiclassy_draw_ad')) {
function aiclassy_draw_ad(){
echo '<div class="advertise_area">
I want my image to be called here
</div>';
echo ' <br /> <div class="advertise_area">
</div>';
echo ' <br /> <div class="advertise_area">
</div>';
echo ' <br /> <div class="advertise_area">
</div>';
}
}
Is it what you need?
echo '<div class="advertise_area">
<img src="http://morelook.com/content/uploads/2011/07/advertise_here_250x250.png" alt="" />
</div>';
EDIT
Based on OP comment: JSFIDDLE
Turn off your adblocker if you have.
You should place an image tag in your div tag, like this:
if(!function_exists('aiclassy_draw_ad')) {
function aiclassy_draw_ad(){
echo '<div class="advertise_area"><img src="image.jpg" alt="" /></div>';
echo ' <br /> <div class="advertise_area">
</div>';
echo ' <br /> <div class="advertise_area">
</div>';
echo ' <br /> <div class="advertise_area">
</div>';
}
}
Related
My HTML Structure is as follows:
<div class="container">
<div class=row 1>
<img src="#" />
<img src="#" />
</div>
<div class=row 2>
<img src="#" />
<img src="#" />
</div>
<div class=row 3>
<img src="#" />
<img src="#" />
</div>
</div>
I will use for each loop. After each two iterations of for each loop, I want to start new container div and row 1, row 2 and row 3 divs. I mean main div should wrap 3 rows and each row div will wrap two images or div. I am using a single loop. How should I apply the for each loop counter for this?
Assuming you have an array of images or other content you want to put into those divs. This is the concept of what you have to do, then you can adapt it as you need or use your favorite coding styling:
<?php
$contents = array('img1.jpg','img2.jpg','img3.jpg','img4.jpg','img5.jpg','img6.jpg');
echo '<div class="container">';
$rowCount = 0;
foreach ($contents as $key => $value) {
if ($key % 2 == 0) {
if ($key > 0) {
echo "</div><!--close .row-->";
}
$rowCount++;
echo '<div class="row row' . $rowCount . '"><!--opening .row-->';
}
echo '<img src="' . $value . '" alt="This is image: ' . $value . '">';
}
echo '</div><!--close .row-->';
echo '</div><!--close .container-->';
It will render:
<div class="container">
<div class="row row1"><!--opening .row-->
<img src="img1.jpg" alt="This is image: img1.jpg">
<img src="img2.jpg" alt="This is image: img2.jpg">
</div><!--close .row-->
<div class="row row2"><!--opening .row-->
<img src="img3.jpg" alt="This is image: img3.jpg">
<img src="img4.jpg" alt="This is image: img4.jpg">
</div><!--close .row-->
<div class="row row3"><!--opening .row-->
<img src="img5.jpg" alt="This is image: img5.jpg">
<img src="img6.jpg" alt="This is image: img6.jpg">
</div><!--close .row-->
</div><!--close .container-->
It will work with whatever amount of images you put in your array.
You can use array chunk to do that, see the following code :
foreach (array_chunk($yourArray, 2, true) as $results)
{
<div class="row">
foreach($results as $result)
{
//display it here
}
</div>
}
Hi here is my Code for the map tag
echo'<div id="page" style="zoom: 100%">';
$img = '<img src="uploads/'.$row['name'].'" class= "advancedpanorama" height="500" usemap="testmap" alt="inner" />';
echo $img;
echo '<map id="testmap" name="testmap">';
echo '<area class="blue" shape="rect" coords="1583,304,1634,343" href="#" alt="Outside" />';
echo '</map>';
echo '<div>';
My Jquery code
$(function() {
$("area").click(function() {
$("img").toggle("puff");
});
});
I'm not able to access the area tag for the click event any help
Thanks in advance
The name of the column is : link. variable-type:varchar.
<img src="<?php echo$link;?>" style="width:300px; height:400px;" />
</html>
Your echo command could be missing an ";"
$link=$row['link'];
<img src="<?php echo $link; ?>" style="width:300px; height:400px;" />
Should work better.
I have a script that I have somehow managed to create (since my knowledge of php is very limited) that basically places author's profile (image, bio, and links to social media) on to authors archive page with all the posts by same author.
the problem with this script is it returns empty href's and src's in the div's if inputs in the authors profile are empty. I understand the reason why it does this, but I do not know how to correct it.
the second problem is if author set up a custom image link that my script returns that image, but what also like to do in case if input for that link is empty is to return an avatar.
Here is my script
/***********************************************************
******************* Custom Author Page *********************
***********************************************************/
function author_info() {
if (is_author($avatar, $id_or_email, $size, $default, $alt)) {
if(get_query_var('author_name'))
$author = get_userdatabylogin(get_query_var('author_name'));
$authorID = $author->ID;
$custom_avatar = get_the_author_meta('imageurl', $authorID);
if ($authorID=="1")
echo ' ';
else
echo '<div class="author_profile author_'. $authorID .'">
<div class="author_avatar"><img alt="Author" src="'. $custom_avatar .'" width="140" height="140" /></div>
<div class="author_info">
<div class="author_description">
<p>'. get_the_author_meta('description', $authorID) .'</p>
<p><strong>Author\'s Website:</strong>'. get_the_author_meta('wesitename', $authorID) .'</p>
</div>
</div>
<div class="author_links">
<img alt="Google Plus Profile" src="'. get_the_author_meta('google_plus_icon', $authorID) .'" width="128" height="64" />
<img alt="Facebook Page" src="'. get_the_author_meta('facebook_icon', $authorID) .'" width="128" height="64" />
<img alt="Twitter Page" src="'. get_the_author_meta('twitter_icon', $authorID) .'" width="128" height="64" />
<img alt="LinkedIn Profile" src="'. get_the_author_meta('linkedin_icon', $authorID) .'" width="128" height="64" />
</div>
</div>
';
?>
<?php }
}
add_action('thesis_hook_before_content', 'author_info');
Your help is highly appreciated.
You can change the function: get_the_author_meta($type, $id) to return a default value.
get_the_author_meta($type, $id) {
**Code to get value **
if(isset($value)) {
return $value;
} else {
return "#"; // Or some other string
}
}
However this solution will mean the links will still show up. If you do not want the links to show up at all you could do:
if(isset(get_the_author_meta('google_plus', $authorID)) && isset(get_the_author_meta('google_plus_icon', $authorID))) :
<img alt="Google Plus Profile" src="'. get_the_author_meta('google_plus_icon', $authorID) .'" width="128" height="64" />
endif;
Then only the links that have a href and a img will show up.
For your avatar you could return a default value. In your code find the place where get_the_author_meta('imageurl', $authorID);
goes. Probably a function like getImageUrl().
In that function do something similar as before:
getImageUrl() {
**Code to get url **
if(isset($value)) {
return $value;
} else {
return "http://www.mysite.com/img/base-avatar.png"; // Or some other base image
}
}
How do I show the image instead of the url?
echo "<b>Image: </b> http://graph.facebook.com/" . $posts['from']['id'] ."/picture?type=large</br>";
Simply use the <img> tag with src set to your url:
echo "<b>Image: </b> <img src='http://graph.facebook.com/"
. $posts['from']['id'] ."/picture?type=large'></br>";
try:
echo "<b>Image: </b><img src='http://graph.facebook.com/" . $posts['from']['id'] ."/picture?type=large'/></br>";
<img src="http://graph.facebook.com/".$posts['from']['id']
."/picture?type=large">
This will build the correct tag.
echo '<b>Image: </b> <img src="http://graph.facebook.com/' . $posts['from']['id'] . '/picture?type=large" /><br />';
Alternatively, without using concatenation:
<b>Image: </b> <img src="http://graph.facebook.com/<?php echo $posts['from']['id']; ?>/picture?type=large" /><br />
Or using short tags:
<b>Image: </b> <img src="http://graph.facebook.com/<?=$posts['from']['id']?>/picture?type=large" /><br />