2013-12-12 4 views
0

맞춤 게시 유형을 만들었습니다. 나는 또한 single-projects.php를 가지고있다. 그러나 어떤 이유에서 커스텀 포스트는 템플릿을 사용하지 않을 것이다. 나는 permalinks를 내뿜 으려고 노력했다. Themefortress Reverie Theme를 사용하고 있습니다.맞춤 게시 템플릿이 작동하지 않습니다.

class projects_post_type { 

function projects_post_type() { 
    add_action('init',array($this,'create_post_type')); 
} 

function create_post_type() { 
    $labels = array(
     'name' => 'Projects', 
     'singular_name' => 'Project', 
     'add_new' => 'Add new', 
     'all_items' => 'All Projects', 
     'add_new_item' => 'Add New Project', 
     'edit_item' => 'Edit Project', 
     'new_item' => 'New Project', 
     'view_item' => 'View Project', 
     'search_items' => 'Search Project', 
     'not_found' => 'No Projects found', 
     'not_found_in_trash' => 'No Projects found in trash', 
     'parent_item_colon' => 'Parent Project:', 
     'menu_name' => 'Projects' 
    ); 
    $args = array(
     'taxonomies' => array('category','post_tag'), 
     'labels' => $labels, 
     'description' => "All Consplan Projects", 
     'public' => true, 
     'exclude_from_search' => false, 
     'publicly_queryable' => true, 
     'show_ui' => true, 
     'show_in_nav_menus' => true, 
     'show_in_menu' => true, 
     'show_in_admin_bar' => true, 
     'menu_position' => 5, 
     'menu_icon' => null, 
     'capability_type' => 'post', 
     'hierarchical' => true, 
     'supports' => array('title','editor','thumbnail','excerpt','custom-fields'), 
     'has_archive' => true, 
     'rewrite' => array('slug' => 'projects', 'with_front' => false), 
     'query_var' => true, 
     'can_export' => true 
    ); 
    register_post_type('projects_post_type',$args); 
} 
} 

$projects_post_type = new projects_post_type(); 

?> 
+0

원본 코드입니까? 아니면 그냥 예를 들어? –

+0

내가 사용하고있는 원본 코드 – user2997903

답변

0

은 여기 실수 사용자 정의 포스트 유형의 포스트 유형이 projects_post_type하지 projects입니다 register_post_type('projects_post_type',$args);

입니다. 변경 사항을 적용 할 수 있도록 그런 다음 다시 영구 링크를 플러시

register_post_type('projects_post_type',$args); 

register_post_type('projects',$args); 

으로 :

당신은 projects하지 포스트 유형으로 key

가 교체 slug로 선언합니다.

single-custom_post_type.php 여기는 single-projects.php입니다.

관련 문제