2016-06-15 4 views
0

У меня есть проект в WordPressМакет для пользовательской категории

в моем проекте есть буксировочный тип записи (видео - фото)

в каждом типе есть пользовательские категории

как может я могу напишите код для каждой категории, каждая категория имеет различный стиль

Какие файлы я должен добавить?

и каков код в каждом из них?

это мой код в functions.php

<?php 
// Rigester Custom Post Video 
add_action('init', 'codex_video_init'); 
/** 
* Register a video post type. 
* 
* @link http://codex.wordpress.org/Function_Reference/register_post_type 
*/ 
function codex_video_init() { 
    $labels = array(
     'name'    => _x('Video', 'post type general name', 'your-plugin-textdomain'), 
     'singular_name'  => _x('Video', 'post type singular name', 'your-plugin-textdomain'), 
     'menu_name'   => _x('Video', 'admin menu', 'your-plugin-textdomain'), 
     'name_admin_bar'  => _x('Video', 'add new on admin bar', 'your-plugin-textdomain'), 
     'add_new'   => _x('Add New', 'pdf', 'your-plugin-textdomain'), 
     'add_new_item'  => __('Add New Video', 'your-plugin-textdomain'), 
     'new_item'   => __('New Video', 'your-plugin-textdomain'), 
     'edit_item'   => __('Edit Video', 'your-plugin-textdomain'), 
     'view_item'   => __('View Video', 'your-plugin-textdomain'), 
     'all_items'   => __('All Videos', 'your-plugin-textdomain'), 
     'search_items'  => __('Search Videos', 'your-plugin-textdomain'), 
     'parent_item_colon' => __('Parent Video:', 'your-plugin-textdomain'), 
     'not_found'   => __('No Video found.', 'your-plugin-textdomain'), 
     'not_found_in_trash' => __('No Video found in Trash.', 'your-plugin-textdomain') 
    ); 

    $args = array(
     'labels'    => $labels, 
       'description'  => __('Description.', 'your-plugin-textdomain'), 
     'public'    => true, 
     'publicly_queryable' => true, 
     'show_ui'   => true, 
     'show_in_menu'  => true, 
     'query_var'   => true, 
     'rewrite'   => array('slug' => 'video'), 
     'capability_type' => 'post', 
     'taxonomies'   => array('category'), 
     'has_archive'  => true, 
     'hierarchical'  => false, 
     'menu_position'  => null, 
     'supports'   => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments') 
    ); 

    register_post_type('video', $args); 
} 


// Rigester Custom Post Photo 
add_action('init', 'codex_photo_init'); 
/** 
* Register a photo post type. 
* 
* @link http://codex.wordpress.org/Function_Reference/register_post_type 
*/ 
function codex_photo_init() { 
    $labels = array(
     'name'    => _x('Photo', 'post type general name', 'your-plugin-textdomain'), 
     'singular_name'  => _x('Photo', 'post type singular name', 'your-plugin-textdomain'), 
     'menu_name'   => _x('Photo', 'admin menu', 'your-plugin-textdomain'), 
     'name_admin_bar'  => _x('Photo', 'add new on admin bar', 'your-plugin-textdomain'), 
     'add_new'   => _x('Add New', 'photo', 'your-plugin-textdomain'), 
     'add_new_item'  => __('Add New Photo', 'your-plugin-textdomain'), 
     'new_item'   => __('New Photo', 'your-plugin-textdomain'), 
     'edit_item'   => __('Edit Photo', 'your-plugin-textdomain'), 
     'view_item'   => __('View Photo', 'your-plugin-textdomain'), 
     'all_items'   => __('All Photos', 'your-plugin-textdomain'), 
     'search_items'  => __('Search Photos', 'your-plugin-textdomain'), 
     'parent_item_colon' => __('Parent Photo:', 'your-plugin-textdomain'), 
     'not_found'   => __('No Photo found.', 'your-plugin-textdomain'), 
     'not_found_in_trash' => __('No Photo found in Trash.', 'your-plugin-textdomain') 
    ); 

    $args = array(
     'labels'    => $labels, 
       'description'  => __('Description.', 'your-plugin-textdomain'), 
     'public'    => true, 
     'publicly_queryable' => true, 
     'show_ui'   => true, 
     'show_in_menu'  => true, 
     'query_var'   => true, 
     'rewrite'   => array('slug' => 'photo'), 
     'capability_type' => 'post', 
     'has_archive'  => true, 
     'hierarchical'  => false, 
     'menu_position'  => null, 
     'supports'   => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments') 
    ); 

    register_post_type('photo', $args); 
} 
?> 

ответ

0

Просто скопируйте темы "category.php", переименовать "категории-CATID.php" и загрузить папку темы.

Замените CATID идентификатором категории и отредактируйте для своей кошки.

+0

спасибо за ваш повтор , но я хочу, чтобы какая-то вещь отличалась, потому что администратор добавит руководство по категории –

Смежные вопросы