T
T
tbalero2015-09-22 18:52:56
WordPress
tbalero, 2015-09-22 18:52:56

How to create a custom taxonomy page template (to display a list of categories as links)?

- A Custom Post Type is registered on the WordPress site: movies ("Movies");
- Custom taxonomy genres has been registered for "movies" posts ;
- The "genres" taxonomy contains several categories: comedy , thriller , melodrama , etc.

  • To create a template for a separate post of the type "movies" - I use the file single-movies.php
    (*for the page of the form: site.ru/movies/post-o-filme-nomer-odin/ )
  • To create a catalog page template for all records of the "movies" type, I use the archive-movies.php file
    (*for a page of the form: site.ru/movies/ )
  • To create a template for a separate page of a specific category from an arbitrary taxonomy "genres" - I use the file taxonomy-genres.php
    (*for a page like: site.ru/genres/comedy/ )
  • Q: How can I create a custom taxonomy page template, in this case the "genres" custom taxonomy page template?
    (*for page view: site.ru/genres/ )

- That is, you need to make sure that when you go to the page: site.ru/genres/ - a unique template is used (in which, accordingly, you need to write the code to display the list of categories in the form of links - * for these purposes, as far as I understand, you can use wp_list_categories() , after 'taxonomy' => 'category',replacing 'category' in the line with the desired custom taxonomy 'genres').
*Now on the page of the form: site.ru/genres/ - WordPress calls the main page template - index.php . And it is necessary that a separate custom taxonomy page template be called.
*Creating a template file named archive-genres.php didn't work - either I did something wrong, or the template like "archive-$posttype.php" can only be used for post types, not taxonomies.
How to create a custom taxonomy page template (to display a list of categories as links)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Perin, 2015-09-22
@tbalero

taxonomy-genres.php?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question