WordPress.org

Ready to get started?Download WordPress

Forums

Using the read more tag on certain pages only? (6 posts)

  1. gazzank
    Member
    Posted 2 years ago #

    Hey everyone,
    Essentially I have one static front page which shows the two most recent blog posts, and then a normal blog page which shows all the posts as usual.

    On the front page, I am only showing excerpts of the two posts, then I have used the read more tag to link the the rest like this:

    <?php the_content('<span class="readmore">Read more</span>'); ?>

    The problem is that on the blog page the posts now have readmore tags while I want them to show the whole post. Even if I hide the tags themselves, the rest of the post is still hidden.

    Any solutions? =D

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

  3. gazzank
    Member
    Posted 2 years ago #

    That's the way I've done it on the front page, and that part is working fine. Still couldn't find anything about removing it from other pages though.

  4. Michael Mann
    Member
    Posted 2 years ago #

    Are you checking to see whether or not it is the homepage? Why not check to see if it is the home page or front page of the site using this:

    <?php if(is_home() || is_front_page()) the_content('<span class="readmore">Read more</span>'); else
    <?php the_content(''); ?> ?>

  5. alchymyth
    Forum Moderator
    Posted 2 years ago #

    on the blog page the posts now have readmore tags while I want them to show the whole post

    try and apply the method from the linked codex chapter to the blog page template.

  6. gazzank
    Member
    Posted 2 years ago #

    Thanks guys, it's fixed now.

    For anyone else wondering, I just added:
    <?php global $more; $more = true; ?>
    to the blog page, which I believe is what alchymyth said to do =)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.