1
votes

My Need ( More Idea's are welcome ) I need a page for each term, So when i click on a playlist only the songs which belongs to the playlist (term) will be listed.


My Present Situation I am using archive-{post-name}.php for my Custom taxonomy which lists all my Songs from different playlists ( Terms ). I am trying to pass Get values in archive-{postname} but Its not working too ( redirects to homepage )


My Research My research is leading me to custom taxonomy templates.------- taxonomy-{taxonomy}-{term}.php taxonomy-{taxonomy}.php tag-{slug}.php tag-{id}.php category-{slug}.php category-{ID}.php But I can't see how does my need gets addressed?, a Common page for each single Term

3

3 Answers

1
votes

Template hierarchy of wordpress taxomonies :

  • taxonomy-{taxonomy}-{term}.php
  • taxonomy-{taxonomy}.php
  • tag-{slug}.php
  • tag-{id}.php
  • category-{slug}.php
  • category-{ID}.php

from Docs.

0
votes

The category.php, tag.php, and taxonomy.php templates allow posts filtered by taxonomy to be treated differently from unfiltered posts or posts filtered by a different taxonomy. (Note: post refers to any post type – posts, pages, custom post types, etc.). These files let you target specific taxonomies or specific taxonomy terms. For example:

taxonomy-{taxonomy}-{term}.php,taxonomy-{taxonomy}.php,tag-{slug}.php,tag-{id}.php,category-{slug}.php,category-{ID}.php So you could format all posts in an animal taxonomy named news on a page that looks different from posts filtered in other categories. for more information, click here

0
votes

I would like say to create a new "taxonomy-customtaxonomy.php" and use this code as below.

<?php 
$audio_tax = get_queried_object();

$term_audios = 
get_terms( array(
'taxonomy'      => 'customtaxonomy',
'hide_empty'    => false,
'parent'    => $audio_tax->term_id,
) );
?>

Do observe the magic.