Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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());
    }
}
share|improve this question
add comment

1 Answer

Apply wpautop - it converts line breaks into <br /> and double breaks into paragraphs.

echo wpautop( wptexturize( get_yoast_term_description() ) );
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.