php - Wordpress taxonomy template not working -


i created custom wordpress taxonomy, relates post type "portfolio". created taxonomy.php template file. when trying view posts in taxonomy, blank page opens. log empty. how fix it?

the portfolio post type created following code:

add_action( 'init', 'create_post_type' );  function create_post_type() {     register_post_type( 'portfolio',             array(                     'labels' => array(                             'name' => __( 'Портфолио' ),                             'singular_name' => __( 'Работа' ),                             'add_new' => 'Добавить работу',                             'add_new_item' => 'Добавить новую работу',                             'edit_item' => 'Редактировать работу'                     ),                     'public' => true,                     'supports' => array('title', 'editor'),                     'exclude_from_search' => false,                     'taxonomies' => array('portfolio_categories')             )     ); }  

and portfolio_categories taxonomy created following code:

add_action( 'init', 'create_portfolio_taxonomies', 0 ); function create_portfolio_taxonomies(){     $labels = array(             'name' => _x( 'Категории работ', 'taxonomy general name' ),             'singular_name' => _x( 'Категория работы', 'taxonomy singular name' ),             'search_items' =>  __( 'Поиск по категориям' ),             'all_items' => __( 'Все категории' ),             'parent_item' => __( 'Родительская категория' ),             'parent_item_colon' => __( 'Родительская категория:' ),             'edit_item' => __( 'Редактировать категорию' ),             'update_item' => __( 'Обновить категорию' ),             'add_new_item' => __( 'Добавить новую категорию' ),             'new_item_name' => __( 'Новое имя категории' ),             'menu_name' => __( 'Категории работ' )     );  register_taxonomy('portfolio_categories', array('portfolio'), array(         'hierarchical' => true,         'labels' => $labels,         'show_ui' => true,         'query_var' => 'portfolio_categories',         'rewrite' => array( 'slug' => 'portfolio_categories' ) )); } 

you have create template in theme

taxonomy-{yourtaxonomy}-{yourslug}.php 

or

taxonomy-{yourtaxonomy}.php 

if not works go settings -> permalinks , under common settings, let’s use post name. click ‘save changes


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -