Get custom taxonomy description with paragraph tags

I am printing the description for a custom taxonomy of artists with the following code:

$terms = get_the_terms( $post->ID, 'artists');                           
if ( $terms ) {
    // loop through artists (could be multiple)
    foreach ( $terms as $term ) {
        $termid = 'artists_' . ($term->term_id);

        echo '<p id="artist-bio">'; 
        echo $term->description;
        echo '</p>';                            
    }
}

This works great but I would like the line breaks to show up if possible. I tried using the Rich Text Tags plugin which made the description meta_box into a WYSIWYG TinyMCE text editor, but I could not get the provided code to print anything. This is the code I tried:

if(isset($wp_taxonomies)) {
    // This is getting the friendly version of a taxonomy
    // - not the hyphenated get_yoast_term_title()
    $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'artists' ) );
    if($term) {
        echo '<h2 class="pagetitle">'.$term->name.'</h2>';
    }
    // If you have a taxonomy description, let'er rip!
    if(function_exists('get_yoast_term_description') && get_yoast_term_description()) {
        echo wptexturize(get_yoast_term_description());
    }
}

Related posts

Leave a Reply

2 comments