wordpress - Conditional text for certain categories within taxonomy.php -


i building wordpress site using 'easy digital downloads'. downloads have own 'categories'. display archive of categories (different standard archive.php) using template called taxonomy-download_category.php specified in documentation.

this works , can set category archives want. however, want display conditional text depending on category template displaying. example, if category 'test' want show specific text.

i can create brand new template category 'test' using taxonomy-download_category-test.php going have lots of categories , don't want lots of templates.

i've tried several variations of is_tax is_category nothing working.

here's example of i've tried, guess i'm not stating tax/category correctly...

<?php if( is_category( 'download_category-test' ) ) { ?> test <?php } ?> 

i've tried using is_tax using sorts of combinations cannot work. here result of dump if helps me find out should conditionally testing -

object(stdclass)#2868 (10) { ["term_id"]=> int(11) ["name"]=> string(4) "test" ["slug"]=> string(4) "test" ["term_group"]=> int(0) ["term_taxonomy_id"]=> int(11) ["taxonomy"]=> string(17) "download_category" ["description"]=> string(0) "" ["parent"]=> int(0) ["count"]=> int(1) ["filter"]=> string(3) "raw" }

you should use is_tax() this

if ( is_tax( 'download_category', 'test' ) ) {      echo 'the term page viewing called test'; } 

you can use get_queried_object(). var_dump() , inspect output

var_dump( get_queried_object() ); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -