我相信这是wordpress的自定义帖子类型。自定义帖子类型的工作方式与帖子的工作方式相同,您可以为每个帖子类型创建不同的类别,还可以创建不同的存档和单个页面。如果你想在这方面做更多的实验,我将发布一个帖子类型代码示例。您只需将此代码复制并传递到函数中。php的主题,或者你可以把它放在不同的。php文件,您可以require_once
在功能中。像我这样的php文件require_once(\'custom-post-type/team.php\');
我总是创建自定义帖子类型的不同文件夹,然后将所有帖子类型文件放在那里,并将其要求放在函数文件中。
<?php
/* Custom Post Type ===> team_member */
add_action( \'init\', \'register_cpt_team_member\' );
function register_cpt_team_member() {
$labels = array(
\'name\' => _x( \'Team Member\', \'team_member\' ),
\'singular_name\' => _x( \'Team Member\', \'team_member\' ),
\'add_new\' => _x( \'Add New\', \'team_member\' ),
\'add_new_item\' => _x( \'Add New Team Member\', \'team_member\' ),
\'edit_item\' => _x( \'Edit Team Member\', \'team_member\' ),
\'new_item\' => _x( \'New Team Member\', \'team_member\' ),
\'view_item\' => _x( \'View Team Member\', \'team_member\' ),
\'search_items\' => _x( \'Search Team Member\', \'team_member\' ),
\'not_found\' => _x( \'No Team Member found\', \'team_member\' ),
\'not_found_in_trash\' => _x( \'No Team Member found in Trash\', \'team_member\' ),
\'menu_name\' => _x( \'Team Member\', \'team_member\' ),
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => false,
\'supports\' => array( \'title\', \'editor\', \'author\', \'thumbnail\', \'custom-fields\', \'revisions\', \'page-attributes\' ),
//\'taxonomies\' => array(\'post_tag\'),
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_icon\' => \'dashicons-admin-users\',
\'show_in_nav_menus\' => true,
\'publicly_queryable\' => true,
\'exclude_from_search\' => false,
\'has_archive\' => true,
\'query_var\' => true,
\'can_export\' => true,
\'rewrite\' => array(\'slug\' => \'team_member\'),
\'capability_type\' => \'post\'
);
register_post_type( \'team_member\', $args );
flush_rewrite_rules(); // <- do this only once!
}
?>
如果你想知道更多关于自定义帖子类型的详细信息,请参阅wordpress codex。
https://codex.wordpress.org/Post_Types