Archived topic
Adding Taxonomies to generate_archive_title() function?
3 replies · Started by Dave on February 14, 2017
Hi All,
I have a taxonomy (offering_category) which will have a variable number of terms within it. I found the generate_archive_title() function in template-tags.php, but see only instances in which both the taxonomy and term are specified, like so:
elseif ( is_tax( 'post_format', 'post-format-link' ) ) :
_e( 'Links', 'generatepress' );
Since the categories are variable and I'd rather not create an elseif for each category, I think I need something like this:
elseif ( is_tax( 'offering_category' ) ) :
_e( $category_name, 'generatepress' );
But I'm not sure how to get $category_name (where $category_name is equal to the category being viewed). Hoping someone can give me some guidance. :)
Thanks,
Dave
Not 100% sure, but this might help: https://codex.wordpress.org/Function_Reference/get_queried_object
Let me know :)
Thanks! I was able to get it working using the reference you mentioned and the following StackOverflow article:
http://wordpress.stackexchange.com/questions/84267/listing-category
Awesome :)