• Hi I’d like to modify this code to check to see if there’s a featured thumbnail, and if no thumbnail use a default image. Any ideas?

    <?php $nextPost = get_next_post(false);
    if($nextPost) { ?>
    <div class=”nav-box-next”>
    <div class=”nexttitleText”>Next Post </div>
    <?php $nextthumbnail = get_the_post_thumbnail($nextPost->ID,thumbnail); ?>
    <?php next_post_link(‘%link’,”$nextthumbnail”, false);?>
    <p><?php next_post_link(‘%link’,”%title”, false);?> </p>
    </div> <?php } ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ArdorEdor42

    (@ardoredor42)

    The code above works well, but I can’t figure out how to add an if statement do essentially this:

    <?php if ( has_post_thumbnail() ) {
    the_post_thumbnail(‘thumbnail’);}

    else { ?>
    <img src=”<?php bloginfo(‘template_directory’); ?>/images/default-image.jpg” />
    <?php } ?>

    nm

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_the_post_thumbnail’ is closed to new replies.