Support » Fixing WordPress » Adding custom taxonomy description to top of taxonomy displaying

  • Resolved Add1ct3dd

    (@add1ct3dd)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Edit: Ok the description works fine, but is there a way to have a $taxonomy variable to state which taxonomy I’m looking at?

    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding custom taxonomy description to top of taxonomy displaying’ is closed to new replies.