WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] A possible issue with has_post_thumbnail() (2 posts)

  1. OllieMcCarthy
    Member
    Posted 1 year ago #

    Hi, congrats on the cool new features of WP 3.6! I love the new post formats UI :)

    I'm just testing out my themes and I have this code that checks for thumbnail and displays a default image if no featured image is set in the post:

    if (has_post_thumbnail()) {
    the_post_thumbnail('half-landscape', array('class' => 'image-resize'));
    } else {
    echo('<img src="'.get_template_directory_uri().'/images/no-image-half-landscape.png" class="image-resize" alt="no thumbnail available" />');
    }

    New standard posts seem fine but a couple of older posts don't process the else part of the code above. It isn't a case of broken images - all the img markup is missing. I'm not sure what to make of it.

  2. Jose Castaneda
    Member
    Posted 1 year ago #

    What version are you using?

Topic Closed

This topic has been closed to new replies.

About this Topic