WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to modify a loop to hide categories and tags on excerpts? (6 posts)

  1. mtphoto
    Member
    Posted 3 years ago #

    I'm trying to modifying the loop code at the link below to show my categories and excerpts only on full posts. Currently my comments and tags appear under my excerpts and I'd like to remove this.

    I really don't know PHP, but I know I need to work it into a conditional statement, maybe on this line?

    else the_content('Read the rest of this entry »');

    http://www.montanalightphotography.com/misc/index.txt

  2. chinmoy
    Member
    Posted 3 years ago #

    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Categories: <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('Post a Comment', '1 Comment »', '% Comments »'); ?></p>

    Replace above code with my modified code in your php file

    <p class="postmetadata"><!--<?php //the_tags('Tags: ', ', ', '<br />'); ?> Categories: <?php //the_category(', ') ?> |--> <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('Post a Comment', '1 Comment »', '% Comments »'); ?></p>

  3. mtphoto
    Member
    Posted 3 years ago #

    I need to keep the categories and tags on my full posts. Won't this remove the categories and tags completely?

    Thanks.

  4. chinmoy
    Member
    Posted 3 years ago #

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

    write this.

  5. mtphoto
    Member
    Posted 3 years ago #

    Thanks chinmoy29!

    ($displayed < 3)

    The above worked almost completely. The tags and categories showed in their proper place, except they did not show on the second full post for some reason.

    When I changed it to this, then it worked completely:

    ($displayed <= 3)

    If I need another fix on this loop, should I post it here, or start another topic?

    For anyone else who finds this post, I got the loop from a coder named GrandSlambert:
    How can I display a featured post on my home page?

  6. chinmoy
    Member
    Posted 3 years ago #

    start another topic and mark it as resolved.

    Thanks
    C

Topic Closed

This topic has been closed to new replies.

About this Topic