WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Display Featured Images From Pages on One Main Page

[Resolved] Display Featured Images From Pages on One Main Page

  • I am trying to display all my pages featured images in custom manner on one main page.

    I have found this:
    <?php $featured_image = new WP_Query(‘page_id=114’); ?>
    <?php while ($featured_image->have_posts()) : $featured_image->the_post(); ?>

    <?php if (function_exists(‘has_post_thumbnail’) && has_post_thumbnail()) { ?>

    <?php $img_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), array( 205,168 )); ?>

    <div class=”the-image”>
    “><img src=”<?php echo $img_src[0]; ?>” />
    </div>

    <?php }; ?>

    <?php endwhile; ?>
    <?php wp_reset_query(); ?>

    It works, BUT only for a selected page and I want all my pages that have them. Also the permalink doesn’t work.

    Any and all help would be great!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • FOUND IT FOR ANYONE ELSE

    <?php query_posts(array(‘child_of’ => 0, ‘post_type’ => ‘page’)); while (have_posts()) { the_post(); ?>

    <div class=”blind-subpage”>

    <?php if ( has_post_thumbnail() ) {?>

    <?php the_post_thumbnail(); ?>
    <?php the_title() ?>

    <?php } else { ?>

    <!– Else Don’t show anything –>

    <?php } ?>

    <!– closes blind-subpage –>
    </div>

    <?php } ?>

    Do you have a link for the page, where you have inserted the code?

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Display Featured Images From Pages on One Main Page’ is closed to new replies.