WordPress.org

Ready to get started?Download WordPress

Forums

Only include "Read More" on long posts (6 posts)

  1. giantchild
    Member
    Posted 3 years ago #

    Hello,
    I have been trying for a while to figure out how to edit my theme so that the "Read More" function is only used when I choose to add the tag in a post. As of right now, I think it's hard-coded into the theme and appears on every post regardless of how long or short, and it doesn't require adding the "More" tag into a post for it to appear.

    I'm using the Blogum theme (http://wpshower.com/themes/blogum/), and the URL I'm using it at is http://giantchild.com

    Any help figuring this out would be appreciated!
    Thanks!

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    try to edit loop.php;

    <a href="<?php the_permalink() ?>#more" class="more">Read More</a>

    change this to:

    <?php if( strpos($post->post_content,'<!--more-->') >= 1) : ?>
                    <a href="<?php the_permalink() ?>#more" class="more">Read More</a>
    <?php endif; ?>

    the 'read more' should then only be shown on post where you have used the 'more tag'.

  3. giantchild
    Member
    Posted 3 years ago #

    Thanks, I will give that a try.

  4. giantchild
    Member
    Posted 3 years ago #

    Thanks Alchymyth, that worked perfectly!

  5. urbanizing
    Member
    Posted 2 years ago #

    @giantchild Nice blog! how did you managed to put the search field with black background?!

  6. giantchild
    Member
    Posted 2 years ago #

    Hey @urbanizing,

    I just changed the color in the stylesheet, look for that line and change the background hex "background: #000;). This line of code is pretty close to the top of your stylesheet.

    .search {width: 225px; float: right; position: relative; top: -42px; background: #000;}

Topic Closed

This topic has been closed to new replies.

About this Topic