• Hi,

    I have this code, and I want to only show the “read more” when the actual content is more than the limit I have set.

    <?php $content = get_the_content();
          $content = strip_tags($content);
          echo substr($content, 0, 1500);
    ?>…<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">read more.</a>

    And I want to put a if and if / else /endif in there like I do for my titles like this:

    <?php $title  = the_title('','',false);
       if(strlen($title) > 20):
      echo trim(substr($title, 0, 25)).'...';
      else:
      echo $title;
      endif;
      ?>

    But I cant get it to work 🙁
    Anyone who can help me with this?

The topic ‘Only show read more when necessary’ is closed to new replies.