我已使用以下函数注册新的“指南”内容类型:
add_action( \'init\', \'guide_post_type\' );
function guide_post_type() {
register_post_type(\'guides\',
array(
\'label\' => \'Guides\',
\'description\' => \'\',
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'rewrite\' => array(\'slug\' => \'guide\'),
\'query_var\' => true,
\'has_archive\' => true,
\'exclude_from_search\' => false,
\'supports\' => array(\'title\',\'editor\',\'excerpt\',\'comments\',\'thumbnail\',\'author\',),
\'labels\' => array (
\'name\' => \'Guides\',
\'singular_name\' => \'Guide\',
\'menu_name\' => \'Guides\',
\'add_new\' => \'Add Guide\',
\'add_new_item\' => \'Add New Guide\',
\'edit\' => \'Edit\',
\'edit_item\' => \'Edit Guide\',
\'new_item\' => \'New Guide\',
\'view\' => \'View Guide\',
\'view_item\' => \'View Guide\',
\'search_items\' => \'Search Guides\',
\'not_found\' => \'No Guides Found\',
\'not_found_in_trash\' => \'No Guides Found in Trash\',
\'parent\' => \'Parent Guide\',
),
)
);
}
我想在我的博客主页上显示这些帖子以及普通帖子。为此,我创建了一个
home.php
具有以下代码的文件:
remove_action( \'genesis_loop\', \'genesis_do_loop\' );
add_action( \'genesis_loop\', \'custom_homepage_loop\' );
function custom_homepage_loop() {
global $paged;
global $query_args;
$args = array(
\'post_type\' => array(\'post\',\'guide\')
);
genesis_custom_loop( wp_parse_args($query_args, $args) );
}
genesis();
然而,我仍然无法在我的主页上看到任何引导帖子类型。
有什么建议吗?