Support » Fixing WordPress » Want to show Excerpt rather than full posts on home page

  • Hi all,

    I want to show excerpts rather than full posts on my home page. I searched the forum and most of the people say you need to change the_content(); with the_excerpt(); in your index.php file. Well, I checked that file but could not find any of these functions. Below I have placed all the code from my theme’s index.php file so please anyone can suggest what changes should I made in the following code.

    <?php global $theme; get_header(); ?>
    <div id="main">
    <?php $theme->hook('main_before'); ?>
    <div id="content">
    <?php $theme->hook('content_before'); ?>
    if (have_posts()) : while (have_posts()) : the_post();
    * The default post formatting from the post.php template file will be used.
    * If you want to customize the post formatting for your homepage:
    * - Create a new file: post-homepage.php
    * - Copy/Paste the content of post.php to post-homepage.php
    * - Edit and customize the post-homepage.php file for your needs.
    * Learn more about the get_template_part() function:
    get_template_part('post', 'homepage');
    else :
    get_template_part('post', 'noresults');
    <?php $theme->hook('content_after'); ?>
    </div><!-- #content -->
    <?php get_sidebars(); ?>
    <?php $theme->hook('main_after'); ?>
    </div><!-- #main -->
    <?php get_footer(); ?>


    Other than this, I also want to know how I can check my post ids. I need post ids to set them as featured posts(the theme asks for post ids). So, please anyone can suggest something for this as well.

    Thanks in advance for your help and I look forward to your replies.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Did you read the page mentioned in the code you posted?

    Try replacing

    get_template_part('post', 'homepage');


    get_template_part('excerpt', 'homepage');

    and see what happens.

    Keep in mind that if you are editing theme files, you will lose your modifications when the theme is updated. You should make changes via a child theme.

    Thanks for your reply. I am completely new to all this so I am just wondering what you mean by a child theme. Also what kind of modifications will be lost? Modifications to theme? Or content and pictures as well? I have not made any changes to the code until now, just added posts and pictures and selected widgets for sidebars.


    If you have a complex theme and you don’t know your way around the files, this could be a bit of a pain. Just go to the plugins repository and find yourself a nice excerpt plugin. They are much more flexible than using the_excerpt anyway. I use Excerpt Editor to show one post in full, the rest in excerpt, it has settings for different archives, the length of the excerpts, etc. and all that from a settings menu in the dashboard.


    I’ve the same problem as well. I’ve a custom post type named ‘projects’ and I prepared it’s template file named ‘projects-page.php’. In it I changed

    <?php get_template_part( 'content', 'page' ); ?>


    <?php get_template_part( 'excerpt', 'projects-page' ); ?>

    But after this change I can’t see any of the posts that should be there.

    What am I doing wrong?


    cansurmeli you’re looking at the wrong place. You have to edit the loop. Like I said, when you don’t know what you’re doing, just use a plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Want to show Excerpt rather than full posts on home page’ is closed to new replies.