Excerpt lenght and ‘Read More’ tags in WordPress

Excerpt Introduction

The Excerpt introduced to WordPress after 0.71 version but it can control after 2.9 version and it refers to an optional summary or description of a post; that we can say, a post summary. Automatic excerpt which contains first 55 words of the post’s content will be displayed unless you do not provide an explicit excerpt to a post (in the post editor’s optional excerpt field).

wordpress_custom_excerpt_length

The Excerpt has two main uses:

  1. It replaces the full content in RSS feeds when the option to display summaries is selected in Dashboard › Settings › Reading.
  2. Depending on the WordPress theme, it can be displayed in places where quick summaries are preferable to full content:
    • Search results
    • Tag archives
    • Category archives
    • Monthly archives
    • Author archives

How to display excerpt in post/article:

if your current theme showing content only in blog post or article, remember the theme using wordpress content function to display it.

<?php the_content() ?>

Now, if you want to change it to show excerpt just replace the below code inside your post loop:

<?php the_excerpt(); ?>

 

If you want to use any conditional tags for showing excerpt in your category or archive post type just follow the below example:

<?php if ( is_category() || is_archive() ) {
	the_excerpt();
} else {
	the_content();
} ?>

 

How to change the limit & Tag for Excerpt:

Its pretty simple to change the default excerpt length in wordpress. Suppose you want to exceed your length to 100 words then paste the below code in function.php file.

Code:

add_filter('excerpt_length', 'new_excerpt_length');
function new_excerpt_length($length) {
    return 100;
 }

Right now, if you want add your own words to point the end tag of excerpt (default: [….]) paste the below code which will show ‘Read More Here….

add_filter('excerpt_more', 'new_excerpt_more');
function new_excerpt_more($more) {
    return 'Read More Here…';
 }

That’s all. Further need any information regarding this issue just drop a comment in below. Hope our feedback satisfy your requirements. Thanks.

This post has already been read 3716 times!

Mehedi Hasan

Cool WordPress Developer having much agile experience to develop any kind of WordPress sites & plugins. Also good in troubleshooting, fixing & making any kind of tweaks for WP site.

More Posts

Mehedi Hasan

Cool WordPress Developer having much agile experience to develop any kind of WordPress sites & plugins. Also good in troubleshooting, fixing & making any kind of tweaks for WP site.

4 thoughts on “Excerpt lenght and ‘Read More’ tags in WordPress

  • June 16, 2014 at 6:17 am
    Permalink

    I’m not sure where you are getting your info, but this is really good topic.
    I needs to spend some time to learn more from here. Thanks.

  • July 7, 2014 at 4:32 am
    Permalink

    I see a lot of interesting content on your website.I really enjoy reading this. Please go ahead & post regularly to have more nice knowledgeable content for us. Thanks

  • August 29, 2014 at 3:23 am
    Permalink

    Great man !!! Feel happy to read your content & nice to have these resource. Carry on.. Thanks

  • October 30, 2014 at 4:29 pm
    Permalink

    oh..oooo that’s nice. Just thanks 🙂

Comments are closed.