• Resolved Pete

    (@perthmetro)


    This works when I try to display my post title…
    <?php $post_id = of_get_option('tabber_post1', 'no entry' ); $queried_post = get_post($post_id); echo $queried_post->the_title; ?>

    so why doesn’t this work when i try to display my featured image?
    <?php $post_id = of_get_option('tabber_post1', 'no entry' ); $queried_post = get_post($post_id); echo $queried_post->the_post_thumbnail('medium'); ?>

    Thanks heaps 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • Howdy,

    Shooting from the hip — I don’t think you need to echo “the_post_thumbnail()” It spits its result out directly.

    Regards,
    Paul

    instead:
    echo $queried_post->the_post_thumbnail('medium');
    try:
    echo get_the_post_thumbnail($queried_post->ID, 'medium');

    Thread Starter Pete

    (@perthmetro)

    Great, it works! Thanks heaps 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to display a featured image by querying a specific post?’ is closed to new replies.