更改功能,在Thrive可视化编辑器中的插件类中找到

时间:2019-04-25 08:22:34

标签: php wordpress function

我正在使用Thrive可视编辑器,对于“ Post grid”元素,当您进入网格选项时,那里有一个字段显示“ Individual Posts / Pages”,该字段仅提取帖子/页面和我的自定义帖子类型没有被提取

这是在“ class-tcb-postgrid-element.php”中找到的代码

class TCB_Postgrid_Element extends TCB_Element_Abstract {

    /**
     * Constructs the post lists for "Individual Post / Pages filter"
     *
     * @return array
     */
    public static function get_posts_list( $term ) {
        $args    = array(
            'order_by'    => 'post_title',
            'post_type'   => array( 'page', 'post' ),
            'post_status' => array( 'publish' ),
            's'           => $term,
        );
        $results = new WP_Query( $args );

        $list = array();
        foreach ( $results->get_posts() as $post ) {
            $list[] = array( 'id' => $post->ID, 'text' => $post->post_title );
        }

        return $list;
    }

    //... other functions here

}

您可以看到我是否添加了帖子类型,但我正在编辑插件文件本身

'post_type'   => array( 'page', 'post', 'application', 'services' ),

如何修改它以便可以将其添加到我的functions.php文件中?

0 个答案:

没有答案
相关问题