Adding a div box / with Button under Featured Image in posts

I’ve managed to add a ‘featured image‘ that floats to the left that populates each post excerpt on my WordPress website’s homepage. Similar to how it comes in on this website: http://tinyurl.com/y8tk6oq BUT! I’m trying to add a div / button to appear under it, taking the width of my image, with just a tiny bit of padding. I’d love to add within this working code so that it appears at all my posts the same, and I’d work with each individually to add the corresponding separate links.

I’ve made several attempts at duplicating what’s working below but with a DIV, repositioned underneath, but still no such luck.

 <?php if($image= get_post_meta($post->ID, "image", true)) { ?>
                        <div class="postImage">
                        <img class="postImg" src="<?php echo $image; ?>" /> 
                        </div>                    
                    <?php } else if($isbn= get_post_meta($post->ID, "isbn", true)) { ?>
                        <div class="postImage">


                        <img class="postImg" src="http://www.randomhouse.com/images/dyn/cover/?source=<?php echo $isbn; ?>&height=225&maxwidth=150" />

                        </div>

                <?php } else { print"<div>";}?>    

Related posts

Leave a Reply

1 comment

  1. If you just want to add a button, you can just add an anchor in the loop. I’ve added a button with a class of readmore which you can then apply CSS rules to.

     <?php if($image= get_post_meta($post->ID, "image", true)) { ?>
                        <div class="postImage">
                        <img class="postImg" src="<?php echo $image; ?>" /> 
                        </div>                    
                    <?php } else if($isbn= get_post_meta($post->ID, "isbn", true)) { ?>
                        <div class="postImage">
    
    
                        <img class="postImg" src="http://www.randomhouse.com/images/dyn/cover/?source=<?php echo $isbn; ?>&height=225&maxwidth=150" />
                        <a href="<?php the_permalink(); ?>" class="readmore">Read More</a>
                        </div>
    
                <?php } else { print"<div>";}?>    
    

    Edit: If you don’t want to link to the permalink of the post, and instead want to link to an external URL of your choosing on a post-by-post basis, you can accomplish that by using custom fields. Check out this article for a how to.