0

我已在一页中显示所有帖子类型,但我的代码不受最终用户支持。我的意思是我想当用户使用自定义类型帖子插件添加自定义类型时,帖子类型应该自动添加到我的代码中。我的代码现在如下。

    $post_types = array('a', 'b','c','d','e');//post type names
    foreach( $post_types as $post_type) {

    // The Query
    $the_query = new WP_Query( array(
     'post_type' => $post_type,
     'orderby' => 'post_date',
     'order' => 'DESC',
     'showposts' => 1,
    ));

我希望在用户添加自定义帖子类型时自动添加变量 $post_types。

4

0 回答 0