在WordPress中,我将添加一个自定义帖子类型,名为:MultiMedia
我已经通过CPTUI插件创建了一个自定义帖子类型,并且还粘贴了CPTUI提供的代码,来自"获取代码"菜单到Funtion.php的结尾:
function cptui_register_my_cpts_multimedia() {
/**
* Post Type: MultiMedia.
*/
$labels = array(
"name" => __( 'MultiMedia', '' ),
"singular_name" => __( 'MultiMedia', '' ),
.
.
.
"attributes" => __( 'MultiMedia Attributes', '' ),
"parent_item_colon" => __( 'Parent MultiMedia:', '' ),
);
$args = array(
"label" => __( 'MultiMedia', '' ),
"labels" => $labels,
.
.
.
"supports" => array( "title", "editor", "thumbnail", "custom-fields" ),
"taxonomies" => array( "category", "post_tag" ),
);
register_post_type( "multimedia", $args );
}
add_action( 'init', 'cptui_register_my_cpts_multimedia' );
然后我在主题文件夹中创建了一个multimedia.php:
<?php /* Template Name Posts: MultiMedia */ ?>
<?php get_header(); ?>
<div class="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
MultiMedia post type is working!
<?php endwhile; ?>
<?php endif; ?>
</div> <!-- end #main -->
<?php get_footer(); ?>
问题是多媒体不在NewPost侧边栏的DropDown模板列表中,如预期的那样
这是正确的方法吗?
帮我解决这个问题
-Thanks