Displaying the_content until the more tag and stripping html
-
I have a site where I’d like to use the more tag, but I don’t want the images I have set at the top of the post to show up.
For the moment I am hacked something together to strip all the html tags:
/* Custom Excerpt Function */ function wpt_strip_content_tags($content) { $content = $post->post_content; $content = strip_shortcodes($content); $content = str_replace(']]>', ']]>', $content); $content = strip_tags($content); return $content; }
And here’s how it’s displayed:
$excerpt_content = get_the_content(''); echo '<p>' . strip_tags($excerpt_content) . '</p>';
But I’m wondering if there’s a simpler way to do this.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Displaying the_content until the more tag and stripping html’ is closed to new replies.