The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Adding custom taxonomy description to top of taxonomy displaying (3 posts)

  1. Add1ct3dd
    Posted 4 years ago #

    So for example if I had website.com/genres/rock I'd want to show the description for the Rock tag in the Genres custom taxonomy.

    After a bit of searching around i added this into my taxonomy.php:

    <div id="description">
    				$termDiscription = term_description( '', get_query_var( 'genre' ) );
    				if($termDiscription != '') : ?>
    				<div class="tag-desc"><?php echo $termDiscription; ?></div>
    				<?php endif; ?>

    However it doens't seem to work, does anyone have any ideas?
    Also i have multiple custom taxonomies, so is there a variable that has info of the taxonomy you are viewing? so i could replace get_query_var('genre') to get_query_var($taxonomy), otherwise i'll have to have taxonomy-genre.php, taxonomy-bob.php etc!


  2. Add1ct3dd
    Posted 4 years ago #

    Edit: Ok the description works fine, but is there a way to have a $taxonomy variable to state which taxonomy I'm looking at?

  3. Add1ct3dd
    Posted 4 years ago #

    $termDiscription = term_description( '', get_query_var( 'genre' ) );
    $termDiscription = term_description( '', get_query_var( 'taxonomy' ) );

    It actually knows which taxonomy it's using :).
    Job done!

Topic Closed

This topic has been closed to new replies.

About this Topic