Grow your CSS skills. Land your dream job.

How can I grab the Featured Thumbnail attached to the Blog page?

  • # February 4, 2013 at 4:27 pm

    I have a static home page and another page for my blog. Every time I try to grab the thumbnail I’ve attached to the Blog page itself it just grabs the one from the first post.

    # February 4, 2013 at 4:47 pm

    You need to set a query to get the thumbnails for each post.

    # February 5, 2013 at 3:09 pm

    I’m not trying to get the thumbnails for each post. I am only trying to get the thumbnail for the current page. On other pages it’s easy, you can just use the_post_thumbnail(), but if you use that on the blog page, it just grabs the thumbnail of the first post (even if I call it before the loop).

    # February 5, 2013 at 4:07 pm

    From the codex:

    This tag must be used within The Loop. Use get_the_post_thumbnail($id, $size, $attr ) instead to get the featured image for any post.

    http://codex.wordpress.org/Function_Reference/the_post_thumbnail

    # February 5, 2013 at 4:26 pm

    I think get_attachment is another.

    # February 5, 2013 at 6:22 pm

    @begetolo, I’m NOT trying to get the thumbnail from a POST. I’m trying to get the thumbnail from the current PAGE.

    @chrisburton, I’ve tried various get_attachment options and all ended up the same. Any time I try to grab data from the Blog page, it’s just grabbing them from the posts from the loop, even though my code comes before the loop

    # February 5, 2013 at 7:41 pm

    I’ve figured it out. I get the blog page ID, and then that ID lets me get the proper thumbnail.

    < ?php

    $postspage_id = get_option(‘page_for_posts’);

    echo get_the_post_thumbnail($postspage_id);

    ?>

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".