Php Redux框架,Wordpress,从所有帖子类型中选择页面/帖子

Php Redux框架,Wordpress,从所有帖子类型中选择页面/帖子,php,wordpress,redux-framework,Php,Wordpress,Redux Framework,我正在使用Redux,我想从选择列表中选择一篇文章/页面。但我想从一些帖子类型中选择(或全部)。 这是我对该字段的Redux代码 'fields' => array( array( 'id' => 'featured_post_type', 'type' => 'select', 'multi' => f

我正在使用Redux,我想从选择列表中选择一篇文章/页面。但我想从一些帖子类型中选择(或全部)。 这是我对该字段的Redux代码

        'fields'     => array(
            array(
                'id'       => 'featured_post_type',
                'type'     => 'select',
                'multi'    => false,
                'data'      => 'pages',
                'args' => array('post_type' => array('nyheter_grenene', 'nyheter_forbundet', 'stup') ),
                'title'    => __('Featured Post', TD),
                'subtitle' => __('Selected post will be displayed in page top menu', TD),
                //'desc'     => __('Page will be marked as front for this post type', TD),
            ),
       ),

为了使代码正常工作,您必须在代码中更改两件事。以下是一个工作版本:

'fields'     => array(
    array(
        'id'       => 'featured_post_type',
        'type'     => 'select',
        'multi'    => false,
        'data'     => 'posts',
        'args'     => array( 'post_type' =>  array( 'nyheter_grenene', 'nyheter_forbundet', 'stup' ), 'numberposts' => -1 ),
        'title'    => __( 'Featured Post', TD ),
        'subtitle' => __( 'Selected post will be displayed in page top menu', TD ),
        //'desc'     => __( 'Page will be marked as front for this post type', TD ),
    ),
),
这里的区别是我们有
'data'=>'posts'
(而不是
页面
),并且我们还向
args
数组添加了
'numberposts'=>-1

当您使用
'data'=>'pages'
时,将使用函数
[get_pages()][1]
,该函数仅支持分级文章类型。

在此处询问: