我正在构建以下脚本,以从某个页面的每个子页面查询数据。我有它工作正常,但我无法获得特色图像,因为我正在使用$post->ID
. 我会改变什么$post->ID
为了正确使用我的其他功能?任何帮助都将不胜感激。
$args = array(
\'post_type\' => \'page\',
\'posts_per_page\' => -1,
\'post_parent\' => 91,
\'order\' => \'ASC\',
);
$parent = new WP_Query( $args );
if ( $parent->have_posts() ) :
echo \'<div class="events_lists_on_page">\';
while ( $parent->have_posts() ) : $parent->the_post();
//grab the menu item data
$image_uploaded_meta_id = get_post_meta($post->ID, \'_listing_image_id\', true);
$image_thumb_url = wp_get_attachment_image_src($image_uploaded_meta_id, \'full\');
//grab and save title of post
$title = get_the_title();
//grab and save the link to the post
$link = get_permalink();
//grab content
$the_content = get_the_content();
echo \'<div class="element">\';
echo \'<img src="\'. $image_thumb_url[0] .\'">\';
echo \'<div class="text"><p>\' . $title .\'</p></div>\';
echo \'<p>\'. $the_content .\'</p>\';
echo \'</div>\';
endwhile;
echo \'</div>\';
endif;