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…

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?

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements