2014-10-03 107 views
0

我让所有的岗位类型的选择 选择柱式当其他选择列表

<select name="meta-select" id="select_post_types" class="form-control"> 
    <?php foreach ($post_types as $post_type) { ?> 
    <option value="<?php print $post_type; ?>"> <?php print $post_type; ?> </option> 
    <?php } ?> 
</select> 

得到了成功选择任何岗位类型如何列出一个选择列表中的所有帖子(如果有的话)

但我想填充所有选择的帖子类型的帖子,当管理员从顶部选择选择。

第二个选择之后

<select name="meta-select" id="select_post" class="form-control"> 
    <option value=""> </option>'; 

</select> 

回答

0
<?php 
$args = array(
    'public' => true, 
    '_builtin' => false 
); 

$output = 'names'; // names or objects, note names is the default 
$operator = 'and'; // 'and' or 'or' 

$post_types = get_post_types($args, $output, $operator); 
?> 
<select name="meta-select" id="select_post" class="form-control"> 
    <?php 
    foreach ($post_types as $post_type) { 

     ?> 
     <option value="<?php print $post_type; ?>"> <?php print $post_type; ?> </option> 

     <?php 
    } 

    ?> 
</select> 
+0

这将添加自定义文章类型填充现在我想,当用户从列表中选择,然后与选择CTP组装标题的帖子的任何自定义类型选择列表在其他选择列表控件中... – Bilal 2014-10-03 10:48:42