WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Bowe
    Member
    Posted 4 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:

    <?php
    $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; ?>
    </div>

    <div>
    <?php

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

  2. esmi
    Forum Moderator
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.