Wrap Meta Box with <li> and </li> for each new line

I'm trying to automate one of our posting aspects. We post a lot of lyrics and have a system of meta boxes which we use to input various pieces of information about each set of lyrics we post. One aspect that is a little annoying is having to search replace li/litags to the start and end of each new line of lyrics. I was hoping to have PHP echo this automatically but my code is not working at the moment. Here is my untouched code which outputs a verse of lyrics (we use wpautopso that line breaks are respected):

?php if ( get_post_meta($post-ID, '_cmb_lyrics_1', true) ) : ?
?php $lyrics_1 = get_post_meta($post-ID, '_cmb_lyrics_1', true) ?
ul
?php echo wpautop( $lyrics_1) ; ?
/ul
?php endif; ? 

And here is my attempt at outputting litags, which didn't work. :(

?php if ( get_post_meta($post-ID, '_cmb_lyrics_1', true) ) : ?
?php $lyrics_1 = get_post_meta($post-ID, '_cmb_lyrics_1', true) ?
ul
?php 
echo "li\n"; wpautop( $lyrics_1) ; "/li\n"; ?
/ul
?php endif; ?

Any help appreciated. Thanks.

Topic line-breaks list Wordpress

Category Web


Try:

<li>
    <?php echo wpautop( $lyrics_1);?>
</li>

instead of this line:

<?php echo "<li>\n"; wpautop( $lyrics_1) ; "</li>\n"; ?>

edit: thanks @Toscho for the syntax edit, I made a hasty error in my earlier revision ;-)

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.