Newlines in the_content?
-
Okay, I need help here…
I need to have each paragraphs in my posts enclosed by -tags. The function the_contents unfortunately does’nt do this – it just wraps the entire post in a single -tag, with aat the end of each paragraph/line.
So in order to do this, I have this:
$PostContents = get_the_content(__('[Læs mere...]'));
$PostContents = apply_filters('the_content', $PostContents);
$PostContents = str_replace(']]>', ']]>', $PostContents);
$PostContents = str_replace ('', '
', $PostContents);
It almost works, BUT:
Now all my lines ends with the string
, and the next line starts with a space.
My guess is that I should replace the newline in the last line of the code, but what is the character code for that, when it is UTF-8? I tried'�A;', '
in the last line of the above code, and also
�A;'�D;
, but it does absolutely nothing – and neither does<backslash>n
(it strips the backslash when sending?).
So, what code is it then?
- The topic ‘Newlines in the_content?’ is closed to new replies.