WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

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.