0

I'm using the Thematic framework along with custom post type ui plug in to make custom posts. So far I can access the permalink page of the custom posts, but they don't appear on the main index of posts made. I was wondering if it was possible to make the custom post types appear as part of the main post feed and how it is done if possible.

4

1 回答 1

0

这是来自 wordpress文档

把它写在你的主题文件夹functions.php文件中:

function add_post_type_home_query( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
        $query->set('post_type', array( 'post', 'your_custom_post_type' ) );
    }
}
add_action( 'pre_get_posts', 'add_post_type_home_query' );

不要忘记用您创建的实际 post_type 替换 'your_custom_post_type'。

于 2013-07-31T09:41:48.683 回答