我的自定义帖子类型是我需要创建一个包含自定义帖子类型中所有作者的下拉列表的资源。这对任何人都没有帮助吗?
<?php
$post_types = 'resources';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
$args_autours = array(
'post_type' => $post_types,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title,
'show_option_all' => 'SERIES'
);
$authors_sermon =array();
?>
//带下拉列表的表单。查询下面的帖子
<form method="post" action="#" id="dropdownauthors">
<?php query_posts( $args_autours );
if (have_posts()) : while (have_posts()) : the_post();
$authors_sermon[] = get_the_author();
$authors_sermon = array_unique($authors_sermon);
endwhile;
echo '<option value="#">Speaker</option>';
foreach($authors_sermon as $author) {
echo '<option value="' . $author . '">' . $author .'</option> ';
}
endif;
print_r($authors_sermon)
?>
<?php
/* wp_list_authors($args_autours); */
?>
</select>
</form>