WordPress.org

Forums

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

  1. Add1ct3dd
    Member
    Posted 3 years ago #

    Hi,
    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">
    				<?php
    				$termDiscription = term_description( '', get_query_var( 'genre' ) );
    				if($termDiscription != '') : ?>
    				<div class="tag-desc"><?php echo $termDiscription; ?></div>
    				<?php endif; ?>
    			</div>

    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!

    Thanks.

  2. Add1ct3dd
    Member
    Posted 3 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
    Member
    Posted 3 years ago #

    Edit:
    $termDiscription = term_description( '', get_query_var( 'genre' ) );
    to
    $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