WordPress.org

Ready to get started?Download WordPress

Forums

How to Display Featured Image's Description (1 post)

  1. jaeeun
    Member
    Posted 9 months ago #

    Hi,

    I'm developing this page;

    http://storyville.jonmarkoff.com/storyvillewp/our-work/

    I'm displaying child pages' features images on their parent pages by using this code, but I'd like to get the images' descriptions as well.

    <?
    $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT');
    
    if ( $child_pages ) :
        foreach ( $child_pages as $pageChild ) :
            setup_postdata( $pageChild );
            $thumbnail = get_the_post_thumbnail($pageChild->ID, 'thumbnail');
            if($thumbnail == "") continue; // Skip pages without a thumbnail
    ?>
            <div class="child-thumb">
              <a href="<?= get_permalink($pageChild->ID) ?>" rel="bookmark" title="<?= $pageChild->post_title ?>">
                <?= $pageChild->post_title ?><br /><?= $thumbnail ?>
              </a>
            </div>
    <?
        endforeach;
    endif;
    ?>

    Please help.

    Thanks!

Reply

You must log in to post.

About this Topic