• I’m using the more-link class. When there is more to read it works fine. It displays as a link to the rest of the content. When there isn’t more to read the “Read More” text still shows up but isn’t a link. Is there a way to make the “Read More” text disapear or be hidden when there isn’t more to read? If so would it need to be done with css or php? Below is the code I’m using.

    <a>" title="Read More <?php the_title(); ?>"><span style="display:block">Read More &raquo;</span></a>

Viewing 7 replies - 1 through 7 (of 7 total)
  • Try:

    <?php if( strpos($post->post_content, '<!--more-->') ) ?> <a class="more-link" href="<?php the_permalink();?>" title="Read More <?php the_title(); ?>><span style="display:block">Read More &raquo;</span></a>

    That should only display the link if there’s a <!--more--> tag.

    Thread Starter ajcke

    (@emerinea)

    There is never a <!--more--> tag. I should have explained more. I’m cutting the content off after 90 characters. Here’s the code that is right before the more code posted above:

    <?php echo substr(get_the_content('', '', FALSE), 0, 90); ?>...

    <a class="more-link" href="<?php the_permalink() ?>" title="Read More <?php the_title(); ?>"><span style="display:block">Read More &raquo;</span></a>

    If I’m posting a quick small post sometimes it’s under 90 characters and the “Read More” text still displays but it’s not a link. I’m assuming since it doesn’t display as a link there is some script somewhere in my site that knows this. I should be able to attach some type of hidden or display:none script to it. Right? If so where would I do this and what code would I use? It’s not in my css. It’s probably where the more-link is defined.

    Thread Starter ajcke

    (@emerinea)

    An if statement should work. Right? If so could you post the code?
    Thanks!

    Try:

    <?php if ( strlen( get_the_content('', '', FALSE) ) < 90 ) ?> <a class="more-link" href="<?php the_permalink();?>" title="Read More <?php the_title(); ?>><span style="display:block">Read More &raquo;</span></a>

    Thread Starter ajcke

    (@emerinea)

    The code above removes all content, but the Read More link does work. So the post has a title and a read more link under the title and no content.

    how to do you add a read more link for pages??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Need Help With more-link’ is closed to new replies.