Forums

WP edits not recognized (6 posts)

  1. smartyd
    Member
    Posted 2 years ago #

    I wanted to display one full post plus excerpts on the front page, and was able to do so by adding:
    <?php $i = 0; while (have_posts()) : the_post(); $i++; ?>
    to the top of the index (instead of <?php while (have_posts()) : the_post(); ?>)
    But suddenly it stopped working. So I decided to have all the front page show as excerpts, so changed
    <?php the_content(); ?> to <?php the_excerpt(); ?>
    That worked. But then I changed my mind and put it back to "content." Now I still get only excerpts showing. Why won't WP recognize my edits? I tried closing the browser and re-opening it, but nothing. All I get are excerpts on the front page.
    Help! Thanks!

  2. smartyd
    Member
    Posted 2 years ago #

    Disregard the second part of the question (resolved).

    Why doesn't the code
    <?php $i = 0; while (have_posts()) : the_post(); $i++; ?>
    work to truncate the remaining posts after the first post?

  3. smartyd
    Member
    Posted 2 years ago #

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Your front page is currently showing full posts.

  5. smartyd
    Member
    Posted 2 years ago #

    Correct. I'd like it to show one full post and then excerpts for the rest. I think it was you, esmi, who suggested the line
    <?php $i = 0; while (have_posts()) : the_post(); $i++; ?>
    as a way of doing this. It worked for a while, but now it doesn't anymore. Did I change it in the course of editing other stuff? Do you have any clue why it doesn't work anymore?
    Thanks

  6. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Probably because you're missing the second part:

    <?php $i = 0; while (have_posts()) : the_post(); $i++; ?>
    [ ...]
    <?php if($i == 1) the_content();
    else the_excerpt();?>

Topic Closed

This topic has been closed to new replies.

About this Topic