• How do I just show an excerpt (with a link to the full post) on the home page instead of the entire entry?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    Instead of the code <?php the_content();?>, just use <?php the_excerpt?>. You can do this either on index.php or home.php

    For example; on index.php, you might have the code snippet

    <?php if(have_posts()) : ?>

    <?php while (have_posts()) : the_post();?>

    <h1>
    title=<?php the_title();?>>
    <?php the_title();?>

    </h1>
    <?php the_excerpt();?>

    <div class=”contentmeta”>
    Written by <?php the_author();?>, on <?php the_time(‘n.j.Y’);?>,
    filed under <?php the_category(‘, ‘)?> and tagged <?php the_tags(”,’ | ‘,”)?> .
    >Continue reading <?php the_title(); ?> →
    </div>

    <?php endwhile;?>

    It will show only the excerpt, and the <?php the_title?> is linked to the full post. Of course on, your single.php, you need to use <?php the_content();?>

    Hi,

    Open index.php file of your theme and edit it as this:

    Find:
    <?php the_content();?>

    Replace with:
    <?php the_excerpt?>.

    Thanks,

    Shane G.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Showing excerpt on home page’ is closed to new replies.