0
這裏在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(); ?>
問題是多媒體不在DropDown模板列表中在NewPost邊欄中如預期的那樣
這是正確的方法嗎?
幫我這個
-Thanks