我试图从Kirki函数中获取类别ID,然后将该ID传递到一个循环中,以查看该特定类别ID中的所有帖子。我在后端编写以下代码:
Kirki::add_field( \'cactus_option\', array(
\'type\' => \'select\',
\'settings\' => \'cat_choose\',
\'label\' => __( \'This is the label\', \'kirki\' ),
\'description\' => __( \'This is the control description\', \'kirki\' ),
\'help\' => __( \'This is some extra help text.\', \'kirki\' ),
\'section\' => \'cat_arrange\',
\'default\' => \'option-1\',
\'priority\' => 10,
\'choices\' => Kirki_Helper::get_terms( \'category\' ),
));And I get this result:
现在,无论我选择了什么类别,我都想把它的ID放在头版。借助该ID的漏洞,我想查看该Pacific ID的所有帖子。我编写了这段代码,因为它只显示ID号,其他什么都没有显示。
<div class="container">
<h1> <?php echo get_theme_mod(\'cat_choose\', $defaults);?></h1>
</div>
But I want to like this: