P
P
PROget2019-02-15 10:39:29
Taxonomy
PROget, 2019-02-15 10:39:29

Wordpress taxonomy, what php file template is needed?

Help me to understand.
I display taxonomy for nesting pages.
I display it on the main page (index.php), when I click I stay on the main page (index.php)
I looked at the Visual Overview section on the official website, but I didn’t understand.
Which template file should be used for the taxonomy?
Output codes.
$cur_cat = get_query_var('cat');
if ( is_home() )
{
$new_cat = wp_list_categories('taxonomy=media_cat&echo=false&child_of=' . $cur_cat . '&depth=2&title_li=&&show_count=1&show_option_none=&&hide_empty=1');
echo($new_cat);
}
taxonomy adding function code:
function init_media_categories() {
register_taxonomy( 'media_cat', '
'label' => __( 'Categories' ),
​​'hierarchical' => true,
'public' => false,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_generic_term_count',
' rewrite' => array( 'slug' => 'media' ),
) );
}
add_action( 'init', 'init_media_categories' );

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Syomka Gavrilenko, 2019-02-15
@cema93

According to the Template Hierarchy , one of the following templates can be used:
5c6674db523ab250678668.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question