Even if you do a nl2br() function on the excerpt.
It’s just a few lines of code. And is designed to do the following in PHP.
- First we will escape quotation marks so that we don’t end up closing out a string too early.
- Last we will get rid of the characters left from the excerpt that are not escaped correctly.
$excerpt = str_replace('"','\"',get_the_excerpt()); $excerpt = nl2br($excerpt); $excerpt = str_replace(array(chr(10), chr(13)), '', $excerpt);
Last updated byon .