Support » Alpha/Beta/RC » the_post_format_image renders full post for standard posts

  • Resolved Bev

    (@bstofko)


    I decided to try using the_post_format_image to grab the first image associated with a post and display it with the excerpt. However, if the post is a standard format it does not grab the first image – the entire post is displayed!

    I’m not sure if I’m using the function as it was intended, but the description in media.php reads:

    “Return the first image in the current (@global) post’s content”

    so I would expect only the first image found in the post to be rendered.

Viewing 7 replies - 1 through 7 (of 7 total)
  • I think that function is only for Image post format, not Standard or any else formats.

    designsimply

    (@designsimply)

    Member

    However, if the post is a standard format it does not grab the first image – the entire post is displayed!

    Is the problem happening for just one post or several?

    I’m not sure it’s post format related. As a test, try temporarily replacing the post content for the affected post(s) with a simple plain text paragraph (no links or images), then clear cache and refresh the page where the_post_format_image() is called.

    My theory is that something in the content is triggering the regex in that function when it shouldn’t.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    Post Formats UI has been removed from 3.6

    When Beta4 comes out, please test this again.

    Okay, I did some more testing with 3.6-beta4-24523.

    I’m using the “Images Test” post from the standard theme test posts. For this post the_post_format_image will not return not the first image. Instead it skips along to the first captioned image (the boat with caption “A picture is worth a thousand words”) and returns that image and all of the following post content.

    Also I noticed if a post has a featured image that is not attached to the post, it will not be displayed.

    i just did some further testing. It seems that the image links on the boat pictures are causing the problems. If I remove the links the first image is selected properly.

    Dominik Schilling (ocean90)

    (@ocean90)

    WordPress Core Developer

    The function the_post_format_image is gone.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘the_post_format_image renders full post for standard posts’ is closed to new replies.