Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

dannybeton on "wp_trim_words formatting"

$
0
0

I'm using the wp_trim_words function to just take the snippet of a custom post's content:

echo '<p>' . wp_trim_words( get_the_content(), 50 ) . '</p>';

The content text is formatted as follows:

"One of our VIP members (well… Ned) has his 1984 black Porsche 924 for sale!

This car is in truly terrific order and is well known locally having been frequently shown at numerous classic car events. To see the advert on DoneDeal click here."

But when wp_trim_words() is used it's displayed as:

"One of our VIP members (well… Ned) has his 1984 black Porsche 924 for sale! This car is in truly terrific order and is well known locally having been frequently shown at numerous classic car events. To see the advert on DoneDeal click here."

The break return after "for sale!" is gone.. Is there any way to keep the formatting of the post when using wp_trim_words() ?


Viewing all articles
Browse latest Browse all 8245

Trending Articles