MTPrower
Member
Posted 7 months ago #
I have a function code that allows special tags in my excerpts. <em> is one of them, working fine. However, I can't seem to get line breaks to show up. If there is a break in the visual editor, I will see it on the post. I just want to be able to see it on the excerpt too. Here is my current code:
[code moderated - please use the http://pastebin.com/ for any code longer than 10 lines - see http://codex.wordpress.org/Forum_Welcome#Posting_Code ]
My site is at http://www.vgreboot.com/ . Thanks.
MTPrower
Member
Posted 7 months ago #
Sorry, I had tried to say:
"I have a function code that allows special tags in my excerpts. "em" is one of them, working fine."
you might need to add <p> to the allowed html tags;
and to avoid to end up with broken tags, try to apply force_balance_tags($text); before the return $text; (which your code seems to be missing, btw)
(untested)
MTPrower
Member
Posted 7 months ago #
I messed around with the functions.php, but I haven't gotten it to work yet...
I messed around with the functions.php
just edit your 'custom_wp_trim_excerpt()' code (maybe you could paste teh code into the pastebin.com and post the link to it here)
MTPrower
Member
Posted 7 months ago #
...I'm sorry, but I don't even know what you're referring to. I have a child template functions.php. Every "core" change I have made is in there.
Here's my pastebin.
http://pastebin.com/K59WSJW9
MTPrower
Member
Posted 7 months ago #
Crap, I forgot to mention that I took
out of the allowed tags just recently. So this code should not be working anyway. The question is, how do I fix it?
http://pastebin.com/XtYyYwM0
the change is basically this line 13:
$text = strip_tags($text, '<em><br><p>');
and in line 25:
$text = force_balance_tags($text) . $excerpt_more;
seems to work ok.
MTPrower
Member
Posted 7 months ago #
You got it working. Thanks!