• Hi, I am just wondering, with WP 1.2, if it is possible to display an excerpt of the full text on the index page instead of the full article? thanks.

Viewing 14 replies - 16 through 29 (of 29 total)
  • I take it threads would be better off revived than making a new one…
    I’ve used the code in crackerboys post, but the problem is this: it shows them on all posts, even when there are no excerpts on them. How can I fix this? Thanks!

    Nobody? :-/

    Hah. Oops, sorry about that. It shows “Read more!” on all posts, even when there are no excerpts on said posts.

    Okay, I’m also trying to do the Excerpt thing. I’ve got it done correctly except that I’m having the same problem as System Of A Jon — I get “read more” on every post. I’m using Crackerboy’s code as well. Any new suggestions?
    J

    Yes, I saw that. I was just wondering if anyone had come up with some sort of way to make Read More a condition, whereas if you had fewer words/characters in your post than in an Excerpt, it would make it go away.
    Since I’m running a group blog, I think my best course of action at this point is to require everyone to have an excerpt.
    *shrug* The little things.

    You can hack the function as has been suggested to show fewer than 120 words or so and thus have fewer full posts in the excerpt. I bet you could set up a hack to do a word count on the excerpt and if it is less than the 120 words, not show the “read more”. Shouldn’t be too hard.

    I will mention that to my PHP guy. I’m not much into PHP myself. Thanks for the suggestion.

    <?php
    if ($single)
    the_content();
    else {
    the_excerpt();
    if (!empty($post->post_excerpt))
    {
    ?>
    ” rel=”bookmark” title=”Permanent Link: <?php the_title(); ?>”>Read more..
    <?php
    }
    }
    ?>

    <?php
    if ($single)
    the_content();
    else {
    the_excerpt();
    if (!empty($post->post_excerpt))
    {
    ?>
    Read more link goes here…
    <?php
    }
    }
    ?>

    <?php
    if ($single)
    the_content();
    else {
    the_excerpt();
    if (!empty($post->post_excerpt))
    {
    ?>
    " rel="bookmark" title="Permanent Link: <?php the_title(); ?>">Read more..
    <?php
    }
    }
    ?>

    <?php
    if ($single)
    the_content();
    else {
    if (!empty($post->post_excerpt)) {
    the_excerpt();
    ?>
    " rel="bookmark" title="Permanent Link: <?php the_title(); ?>">Read more..
    <?php
    } else {
    the_content();
    }
    }
    ?>

    <?php
    if ($single || empty($post->post_excerpt))
    the_content();
    else {
    the_excerpt();
    ?>
    " rel="bookmark" title="Permanent Link: <?php the_title(); ?>">Read more..
    <?php
    }
    ?>

    This will display an excerpt+link if an excerpt is present in the database or just the_content if no excerpt is present. Note that this will interpret the post_excerpt field as empty even if it contains some whitespaces. That’s just in case a user provides an excerpt and then goes back and deletes it, but doesn’t delete all whitespaces.
    <?php
    if (trim($post->post_excerpt) == ”) {
    the_content();
    } else {
    echo ‘excerpt:’;
    the_excerpt();
    echo ‘

    the_permalink();
    echo ‘”>More…‘;
    }
    ?>

    There’s now a plugin that deals with this issue. It checks the db for an excerpt and provides different formatting options conditioned on whether there’s an excerpt:
    https://www.ads-software.com/support/topic.php?id=19478

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘Display excerpt on index?’ is closed to new replies.