我已经问过一个问题,如何只获取属于某个分类法的父页面的子页面。一位非常有帮助的用户给了我这个答案,然而,我没有得到代码来完成循环的任何一方,这样我就可以得到:标题、特色图片和摘录。我得到的代码是:
$child_ids = $wpdb->get_col(
"SELECT ID FROM $wpdb->posts WHERE post_parent = $post->ID AND post_type = \'page\' ORDER BY menu_order"
);
$args = array(
\'post__in\' => $child_ids, // Only retrieve taxonomy posts that are children of this page
\'tax_query\' => array(
array(
\'taxonomy\' => \'top5\',
\'field\' => \'name\',
\'terms\' => $post->post_title
),
),
);
因此,如果有人能告诉我如何使用它来获取标题、摘录和特色图片,那将是非常好的,提前非常感谢!