• Hi,

    I have the following code whereby I have a category page with about 5 article excerpts. Each excerpt have a heading, pic and a string of text with 35 word limit. I have added a ‘read more’. It it currently outside of the paragraph. I however want to include the read more at the end of the string. I am new to PHP so I am not sure how to place it.

    <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                 <?php
                  ob_start();
                  the_content('Read the full post',true);
                  $postOutput = preg_replace('/<img[^>]+./','', ob_get_contents());
                  ob_end_clean();
                  ?>
    
                  <?php
                  $excerpt = $postOutput;
                  $order   = array("<p>", "</p>");
                  $replace = '';
                  #$newstr = str_replace($order,$replace, $excerpt);
                  #$newstr = strip_tags($newstr);
                   $newstr = strip_tags($excerpt);
                                      echo'<p>'.string_limit_words($newstr,35) .'</p>';
    
                                            ?>
    <a href="<?php the_permalink(); ?>">...read more</a>

    I appreciate your help.

    Thanks.

  • The topic ‘'Read more' PHP link’ is closed to new replies.