选择自定义帖子类型的模板菜单?

| 我已经在wordpress中创建了几个自定义帖子类型,并且将hierarchy设置为true,以便其表现为页面。 问题是模板选择不可用。我已应用此技巧使菜单出现:   里面有一个文件meta-boxes.php   wp-admin \\包括wordpress   安装..文件的第547行,   这是功能   page_attributes_meta_box()仅添加   您特定职位的支票   输入名称以显示   模板页面下拉列表。
if ( (\'page\' == $post->post_type  || \'yourcustomposttype\' == $post->post_type) && 0 != count( get_page_templates() ) ) {
        $template = !empty($post->page_template) ? $post->page_template : false;
        ?>
这样可以成功显示菜单,但不会保存数据。 \“ parent \”部分保存,但\“ template \”未保存。 有人有什么想法吗?     
已邀请:
我已经使用了这个插件,可以发帖了,试试看:) https://wordpress.org/extend/plugins/custom-post-template/     
偶然发现这个问题,寻找相同的功能。我知道这有点晚了,但我想我找到了解决方案。通过使用插件查看自述文件,可以将其添加到您要查找的功能的functions.php中。
/**
 * Hooks the WP cpt_post_types filter 
 *
 * @param array $post_types An array of post type names that the templates be used by
 * @return array The array of post type names that the templates be used by
 **/
function my_cpt_post_types( $post_types ) {
    $post_types[] = \'movie\';
    $post_types[] = \'actor\';
    return $post_types;
}
add_filter( \'cpt_post_types\', \'my_cpt_post_types\' );
    

要回复问题请先登录注册