How can I display the_post_thumbnail in a get post query loop? (2 posts)

  1. Bowe
    Posted 6 years ago #

    Hi guys,

    I'm building a custom slider for my theme, and I want to display the_post_thumbnail in my slider.. I've been trying to figure out how to get fetch it, but so far no luck.. This is my example code:

    $post_id = 36;
    $queried_post = get_post($post_id);
    <h2><?php echo $queried_post->post_title; ?></h2>
    <img src="<?php echo $queried_post->post_thumbnail; ?>" alt="" title="" />
    <?php echo $queried_post->post_content; ?>


    I've been trying to find the right statement to use, but no luck.. any help would be appreciated :)

  2. esmi
    Forum Moderator
    Posted 6 years ago #

    Try echo get_the_post_thumbnail($post->ID, 'thumbnail');

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.