WordPress.org

Ready to get started?Download WordPress

Forums

How to get excerpts only on paged pages with my custom loop? (5 posts)

  1. mtphoto
    Member
    Posted 4 years ago #

    I'm using the following loop and cannot seem to get my paged blog posts to show only post excerpts. Page 2 of my posts shows 3 full posts and then excerpts.

    My blog index page is working correctly showing 2 full posts and then excerpts.

    I don't really know PHP, so any help is greatly appreciated.

    Here's the code of my index page:
    http://www.montanalightphotography.com/misc/index.txt

    The original code for the loop was from GrandSlambert here:
    How can I display a featured post on my home page?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Try:

    if ($displayed > 3 || is_paged() )

  3. mtphoto
    Member
    Posted 4 years ago #

    That worked to change my paged blog posts to show only excerpts.

    Unfortunately, it had a side effect of displaying tags and comments on my first three post excerpts on page 2. Previously only my full posts would show tags and categories.

    What can I add to this statement to remove the tags and categories from paged pages?

    if ($displayed <= 3)

    Thank you!

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    Try changing:

    <?php
    if ($displayed <= 3) { ?>
    <div class="post-bottom">
    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Categories: <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <br>  <?php comments_popup_link('Post a Comment', '1 Comment »', '% Comments »'); ?></p>
    </div>
    <?php } ?>

    to:

    <?php
    if ($displayed <= 3 && !is_paged() ) { ?>
    <div class="post-bottom">
    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Categories: <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <br>  <?php comments_popup_link('Post a Comment', '1 Comment »', '% Comments »'); ?></p>
    </div>
    <?php } ?>
  5. thinkluke
    Member
    Posted 3 years ago #

    I have been trying to solve this problem for days but i can't seem to find a solution... has anyone figured it out?

Topic Closed

This topic has been closed to new replies.

About this Topic