Forums

Showing excerpt on home page (3 posts)

  1. rye_ryu
    Member
    Posted 2 years ago #

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

  2. tedheich
    Member
    Posted 2 years ago #

    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();?>

  3. Shane G
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.