我想在控制面板中创建自己的自定义页面(库)选项卡,类似于页面。这有助于我在“画廊”名称下组织画廊页面。我该怎么做?我可以对自定义帖子执行此操作,但这次不会显示模板。:/实际上,我想准确地复制“页面”,并将其命名为“Gallery”。然后我在它下面创建自定义页面。希望你能理解我的问题。
如何在控制面板中复制“Pages”部分?
1 个回复
SO网友:s_ha_dum
这应该与“页面”非常相似。
function gallery_type_custom_init() {
$args = array(
\'public\' => true,
\'label\' => \'Gallery\',
\'capability_type\' => \'page\',
\'hierarchical\' => true,
\'supports\' => array(
\'title\',
\'editor\',
\'thumbnail\',
\'excerpt\',
\'page-attributes\',
\'custom-fields\'
)
);
register_post_type( \'Gallery\', $args );
}
add_action( \'init\', \'gallery_type_custom_init\' );
如果你需要这个来使用custom page templates, 不过,这行不通。That part is hard-coded for page
post types only.结束