scriptygoddess

24 Jul, 2008

Show full post if there is no excerpt

Posted by: Jennifer In: Bookmarks

As the title said – needed to show the excerpt if there was one, or the *full* post if there wasn't (not the shortened version wordpress "fakes")

remove_filter('get_the_excerpt', 'wp_trim_excerpt');
if (get_the_excerpt() == "") {
echo apply_filters('the_content',get_the_content());
} else {
echo apply_filters('the_content',get_the_excerpt());
echo '<p><a href="'.get_permalink().'">Read more...</a></p>';
}

Updated 8/11/08 Made some changes to the code. Excerpts were coming in unformatted, also removed some extra stuff I don't think I needed in there…

Related posts:

  1. Striping IMG tags from the_content in WordPress (and how to fudge page excerpts) Background: For a site I was working on, I was...
  2. Adding a block of HTML to a WordPress post One problem with the WYSIWYG editor in WordPress is that...

Related posts brought to you by Yet Another Related Posts Plugin.

5 Responses to "Show full post if there is no excerpt"

1 | Apoorv Khatreja

August 3rd, 2008 at 2:34 am

Avatar

I really need this feature. How do I implement this code in my WP blog?

And I would also like to know how to get the "Subscribe without commenting" box you have below your posts.

2 | Jennifer

August 4th, 2008 at 8:51 am

Avatar

Replace the code above where you would normally put your excerpt (look at your theme files – it can go anywhere you have the excerpt tag)

As for the subscribe box – that's all part of this plugin:
http://txfx.net/code/wordpress/subscribe-to-comments/

3 | Jennifer

August 4th, 2008 at 8:52 am

Avatar

*rather USE THE CODE above to replace where your excerpt tag. :)

4 | Khaleel

August 7th, 2008 at 1:06 pm

Avatar

This would suffice
//
add_filter('get_the_excerpt', 'custom_trim_excerpt');
//

5 | Jenny

May 31st, 2009 at 7:11 pm

Avatar

isnt there a plugin that does this?

Comment Form

Featured Sponsors

About


Advertisements