我正在尝试构建一个查询,其中列出具有特定自定义字段值的自定义类型的帖子。然后我需要列出帖子中每个帖子的子帖子,这些子帖子还需要通过特定的自定义字段值进行过滤。
这是我当前的代码,它不起作用。任何帮助都将不胜感激。
非常感谢。
<?php
$args = array(
\'post_type\' => \'clients-placements\',
\'posts_per_page\' => -1,
\'post_status\' => \'publish\',
\'order\' => \'ASC\',
\'meta_query\' => array(
array(
\'key\' => \'type\',
\'value\' => \'Client\'
),
array(
\'key\' => \'featured\',
\'value\' => \'yes\'
)
)
);
$the_query = new WP_Query( $args );
?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php get_template_part( \'content\', \'clients\' );?>
<ul id="placements">
<?php
$args = array(
\'post_type\' => \'clients-placements\',
\'posts_per_page\' => -1,
\'post_status\' => \'publish\',
\'order\' => \'ASC\',
\'post_parent\' => $post->ID,
\'meta_query\' => array(
array(
\'key\' => \'type\',
\'value\' => \'Placement\',
),
array(
\'key\' => \'featured\',
\'value\' => \'yes\',
)
)
);
$the_query = new WP_Query( $args );
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
echo \'<li>\';
the_title();
the_content();
echo \'</li>\';
endwhile;
?>
</ul>
<?php endwhile; ?>