Я создал пользовательскую таксономию для теговWordpress же архив шаблон для пользовательского типа поста и систематики
function create_topics_nonhierarchical_taxonomy() {
// Labels part for the GUI
$labels = array(
'name' => _x('Topics', 'taxonomy general name'),
'singular_name' => _x('Topic', 'taxonomy singular name'),
'search_items' => __('Search Topics'),
'popular_items' => __('Popular Topics'),
'all_items' => __('All Topics'),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __('Edit Topic'),
'update_item' => __('Update Topic'),
'add_new_item' => __('Add New Topic'),
'new_item_name' => __('New Topic Name'),
'separate_items_with_commas' => __('Separate topics with commas'),
'add_or_remove_items' => __('Add or remove topics'),
'choose_from_most_used' => __('Choose from the most used topics'),
'menu_name' => __('Topics')
);
// Now register the non-hierarchical taxonomy like tag
register_taxonomy('topics','post',array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'show_in_nav_menus' => true,
'rewrite' => array('slug' => 'topic'),
));
}
и подключил его к моему пользовательскому почтовому типу
register_post_type('video', array(
...
'taxonomies' => array('topics'),
...
));
Обычай пост типа использует archive-video.php
как шаблон архива. Можно ли использовать один и тот же шаблон архива для пользовательской таксономии? Без дублирования файла и его переименования.
http://css-tricks.com/snippets/wordpress/make-archives-php-include-custom-post-types/ – rnevius
Спасибо. Функция не будет работать, потому что я не использую archives.php. Я использую собственный архив с именем archive-video.php (который также находится в подкаталоге) – CyberJunkie