반응형
게시물 유형별 카테고리 구분
별도의 카테고리가 있는 사용자 지정 게시 유형을 만들 수 있는 방법이 있습니까?wordpress?
예:
게시물 유형 "뉴스"에는 "월드" 및 "로컬" 카테고리가 있어야 합니다.게시물 유형 "제품"은 다음을 가져야 합니다.categories: "소프트웨어"와 "하드웨어" 그리고 저는 "소프트웨어" 카테고리를 "뉴스" 포스트 타입으로 설정하는 옵션을 갖고 싶지 않습니다.
이 문제를 해결할 방법이 없을까요?
예제 코드를 사용하여 사용자 지정 게시 유형을 만들 수 있습니다.
function ts_post_type_test() {
register_post_type( 'Test',
array(
'label' => __('Test'),
'public' => true,
'show_ui' => true,
'show_in_nav_menus' => false,
'menu_position' => 5,
'capability_type' => 'post',
'texonomies' => array('category'),
'supports' => array( 'title','editor','thumbnail'),
)
);
}
워드프레스 사이트 링크 : http://codex.wordpress.org/Function_Reference/register_post_type
Create separate for specific posts(특정 포스트에 대한 별도 카테고리 생성)의 경우 다음 링크를 사용합니다.
http://codex.wordpress.org/Function_Reference/register_taxonomy
예제 코드:
register_taxonomy('name of taxonomy', 'post name',array("hierarchical" => true,"label" => "Label Category","singular_label" => "label of taxonomy",'update_count_callback' => '_update_post_term_count','query_var' => true,'rewrite' => array( 'slug' => 'slug name of new registered taxonomy', 'with_front' => false ),'public' => true,'show_ui' => true,'show_tagcloud' => true,'_builtin' => false,'show_in_nav_menus' => false));
언급URL : https://stackoverflow.com/questions/9228767/separate-categories-for-post-types
반응형
'codememo' 카테고리의 다른 글
| Sequelize와 중첩 관계 (0) | 2023.09.15 |
|---|---|
| 아약스는 php에서 반환 값을 얻습니까? (0) | 2023.09.15 |
| __attribute__((시공자)) VC에서 동치입니까? (0) | 2023.09.15 |
| 이 memcpy 구현에서 누락된/최적의 것은 무엇입니까? (0) | 2023.09.15 |
| PowerShell을 사용하여 모든 서비스의 "실행 경로"를 추출하는 방법 (0) | 2023.09.15 |