Sawper hayabosa
Sawper hayabosa

Reputation: 60

new "custom post template" cant be load in new post template list

here in WordPress i'm going to add a Custom Post Type , named : MultiMedia
i have created a Custom Post Type by CPTUI plugin and also have paste the Code provided by CPTUI from "Get Code" Menu to the end of 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' );

then i created a multimedia.php in the theme Folder with:

<?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(); ?>

the problem is multimedia is not in the DropDown List of templates in NewPost sidebar as were expected

is this the correct way?
help me to fix this
-thanks

Upvotes: 0

Views: 37

Answers (1)

W. White
W. White

Reputation: 127

Edit your code from

<?php /* Template Name Posts: MultiMedia */ ?>

to

<?php /* Template name: MultiMedia */ ?>

should do the trick for you.
For more information about creating a own template, go to this site or here

Upvotes: 1

Related Questions