WordPress.org

Ready to get started?Download WordPress

Forums

Next & Previous Post Titles With Thumbnails (2 posts)

  1. jjkilpatrick
    Member
    Posted 4 years ago #

    Here is the code to grab the next post title & the thumbnail:

    <?php prev_post_link('%link&nbsp;&raquo;','%title', TRUE); ?><br /><?php $prevPost = get_prev_post(true); $prevthumbnail = get_the_post_thumbnail($prevPost->ID, array(150,150) ); echo $prevthumbnail; ?>
                        <span class="prev"><?php previous_post('&lsaquo; %', '', 'yes', 'no'); ?></span>
    
                        <?php next_post_link('&laquo;&nbsp;%link','%title', TRUE); ?><br /><?php $nextPost = get_next_post(true); $nextthumbnail = get_the_post_thumbnail($nextPost->ID, array(85,85) ); echo $nextthumbnail;?>
                        <span class="next"><?php next_post('% &rsaquo;', '', 'yes', 'no'); ?></span>

    How can I make it check if the $nextPost is filled and if not just put a blank image?

    Thanks

  2. alchymyth
    Forum Moderator
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.