Try it with this:
<?php
$description = term_description();
if ( ! empty( $description ) ){
// there is a term description
echo $description;
}
?>
http://codex.ww.wp.xz.cn/Function_Reference/term_description
Thread Starter
Pete
(@perthmetro)
Thanks for that, works great… can I ask how I’d prefix this with some html (that also only shows if the term description is present.
Cheers,
Pete
Because term_description() wraps the description in a paragraph I changed the code a little so you can use your own html. in this example I wrapped the description in a h1:
<?php
$description = get_queried_object()->description;
if ( ! empty( $description ) ) : ?>
<!-- html here -->
<h1>
<?php echo $description; ?>
</h1>
<?php endif; ?>
Thread Starter
Pete
(@perthmetro)
That’s great.. thanks so much. A useful little piece of code that!
You’re welcome. Glad you got it resolved.