Subscibe our Newsletter for FREE and stay up to date with our daily lesson*

How to Show Excerpt on Homepage

For wordpress users, a post has two type of length. they are the_content and the_excerpt. You must be know that the content has full content of post, while excerpt only has the summary of it.

Most bloggers want only summary or only excerpt of each post on their homepage to meka their blog has more magazine and clean view. To do it, you can manually edit the PHP on Admin Page:Theme/Appearance > Theme Editor tab However, there is a simple way to do it.

I introduce my recent plugin, it is called Auto Excerpt. You can download it on WordPress Plugin Directory. With this plugin, you can automatically show only excerpt of each post which contains only 413 characters on your homepage, author page, tag page, category page, search page, and archives. Pretty simple isn’t it?

However, if you prefer using manual PHP and have more faith on that way, you can follow:

  1. Login to DashBoard
  2. Open Appereance/Theme > Editor tab
  3. Click index.php or home.php
  4. Find up the php code
    <?php the_content();?>
    or
    <?php the_content("read more content");?>;
  5. Edit and replace it with:
    <?php the_excerpt();?>
  6. Repeat the steps for other page type you want to show only the excerpt, for example: archives.php for the Archive page.
  7. Don’t change <?php the_content();?> on single.php and page.php , you don’t want to shorten your words on the post URL don’t you ?

Anyways, those method can automatically be done just by using Auto Excerpt plugin for sure! :-)

Auto Excerpt WordPress Plugin

From the version 3.0 up you can:

  1. Add “read more” link
  2. Change the “read more” link’s anchor text
  3. Shorten the text on excerpt into specified length, the default and mostly used is 413 characters

Let's talk it out!

37 Responses to “How to Show Excerpt on Homepage”

  • Christian Geus

    Great plugin. But, is it possible to take one single categorie out. I´ve got one post, that comes up with a picture and is fixed to the homepage of my blog. I would like to have the auto-excerpt effect with all posts, but that start-post.
    Thanks a lot,
    Christian


  • julian

    ok, i will try it


  • feakingivasse

    Hello! Depressing klooper for my english jer, buti very nice re say gJ$)Kd!!!.


  • Cheeleanype

    Hello Depressing klooper repayment for the sake my english jer, buti explore agreeable re articulate .


  • Anastasia Iman

    Keep up the good work!


  • msnboy

    Hello, is it possible to show pictures, too? The excerps don’t show any pics. thanks!


    • julian

      i am going to add some feature on the new version one :-)


  • Garfield Wiederwax

    Hello, just today found this blog but I have to say that it seems great. I totally agree with your post. Have a nice day, keep up the nice work and I’ll definitely come back.


  • Alvaro Vaca

    Thank you! You gave me some great information. I almost gave up looking for the answer to my trouble and the theme that I like!
    Regards!


    • julian

      yeah, this is just a little problem but the most common one :-)


  • Greg

    I like the plug-in, but it is sorta broken. It mangles the text in single.php and page.php and doesn’t allow any other plug in to process, e.g., shorttags on pages like that. I had to edit the body of function auto_excerpt in the following ways:

    1) Add the argument $content to that function.
    2) Change your two ‘echo’ statements to return statements.
    3) Change references to $post->post_content to $content instead
    4) Move the first echo (now a return) line that is before the if into the body of an else statement.

    It now works properly, as expected, and does not override any other posts also trying to edit the value of the post’s content.


    • julian

      i see so it is a crash between plugins because of variables

      maybe i will choose more unique names for my plugin’s variables in the future :-)

      Thanks for informing


      • Dan

        The plugin is working great on site, the only problem is that the excerpt is also showing up on top of the posts, how can i fix this, its also not letting me create a read more link at the end of the excerpt.


  • ardi

    Dear Mr. Hokya,

    I have install the Auto Excerpt plugin and thank you for that.
    I would like to know how to edit such plugin if I want to excerpt all my post just in the front page not in every pages…could you let me know please…

    Thanks,
    Aa


    • julian

      now the newest version should solve that :)


  • Blackhorse Finance

    Good share, great article, very usefull for us…thanks.


  • marcus

    Hi, thanks for the great plugin! I am using it on my website. I did some modifications to it, I hope you don’t mind.

    I changed this (to get rid of the BBCode too)

    function stripBBCode($text_to_search) {
    $pattern = ‘|[[\/\!]*?[^\[\]]*?]|si’;
    $replace = ”;
    return preg_replace($pattern, $replace, $text_to_search);
    }

    function auto_excerpt() {
    global $post;
    echo “”.stripBBCode(substr(strip_tags($post->post_content),0,180)).” [...]“;
    if (is_single() || is_page()) {
    echo $post->post_content;
    }
    }


    • marcus

      sorry, I typed wrong on the echo line, it should look like this

      echo “”.substr(strip_tags(stripBBCode($post->post_content)),0,180).” [...]“;


      • julian

        no problem dude :)
        thanks for letting me know and give some feedback


  • Wiran

    Mas, saya sudah coba pluginnya untuk site WP saya. Thanks. Cuma saya pengin spt website mas yang bisa nampilin thumbnail disebelahnya.
    Gimana caranya ya mas ?

    === translation ===

    i have installed and i want to be have the thumbnail as you have on homepage


    • julian

      this plugin is used for basic view
      if you want to have some advanced with additional thumbnail, i think it’s better to have < ?php the_excerpt();?> instead of < ?php the_content();?> on index.php or home.php file


  • lee

    cool


  • Kauo

    You have done an impressive job!


  • Alice

    Great plugin, but I was wondering how I can get it to say “read more…” then linked to the full article.


  • Robert Harding

    Great plugin, only missing is “read more” link.

    I am searching for same at wp codex on how to implement this which they make very complex for beginners, ultimately I found auto excerpt which resolves my problem.

    Thanks for the excellent work and hope read more link in next update.


    • Julian

      hi robert

      as response for your request (and also the other else’s) , i have update the feature for giving a ‘readmore’ link and also controlling the length of the excerpt

      thanks :-)


  • Robert Harding

    Hello Julian,

    Thanks for the update.

    I have updated auto excerpt 3.0 and also implemented read more link at the bottom of each post. I am also able to update length of the excerpt. Both of these update options is available at settings / auto excerpt of wp admin.

    I am really vary much thankful to you for both of these updates in short span of time (with 1-2 days).

    Regards,
    Robert


  • Robert Harding

    Hello Julian,

    There is one more point I like to mention is that auto excerpt limits excerpt length by character count, can it be possible to limit same by word count(even better if sentence) as I see truncation of word too at the end of excerpt.

    Regards,
    Rebert


  • alex

    I cannot live without your plugin, but i dont kno why with the plugin enabled, it shows me an error:

    Warning: Cannot modify header information


    • Julian

      that warning message will be shown if there is a header() command execution

      this plugin contains no header() function

      please check your other installed plugin to remove the warning :-)


      • Alex

        thank you, i realized it was another plugin that was causing the error and auto excerpt worked perfectly.


  • Robert Harding

    Hello Alex,

    Don’t modify header info.

    Just install auto excerpt 3.0 and activate the plugin. Go to settings and click auto excerpt. The auto excerpt will prompt to enter “read more text” and “excerpt length”. Simply fill both field and save.

    Its over. Just check your site to see desired effect (refresh your browser).

    Regards,
    Robert


  • musang

    Great Thanks for this great working plugins this is make me very easy to change the excerpt on my site and i want to suggest for the future release can you add the option to also use php code after the read more text options like auto use post title after the read more text that’s would be like this : Read the rest of “my post title”
    And if there is using the title on the read more link i think that’s better for SEO


  • zidan

    Great, nice plugins. But how to make it show picture in the excerpt?

    Thanks..


  • Uganda people

    thanks for the pice of code. it worked


What is in your mind ?

Subscribe Me

Learn more the basic tips about WordPress and PHP coding. You can subscribe to our Newsletter to stay in touch with every new stories FREE

Sponsors

WooThemes - Where there's a Woo, there's a way!

Our FaceBook (new)


Discussion Topics

Who am I ?

My name is Julian Widya Perdana. I study at University of Gadjah Mada, Yogyakarta. I am a young developer addicted in JavaScript, Plugins, Themes, AJAX, and PHP developement. If you need anything, then submit it on Contact Us. If you feel satisfy with my work, please support me to keep it developed

Our Community

Discussion

tania

aq msh lund ngrti nh.... wat temen" semua... mhon bntuan yh?????????

markez linda

I don?t usually reply to posts but I will in this case. :)

fath17

very good information....thx...
Close