Hi All, I am trying to modify a theme. Currently it is showing the full post details on the home page however I want to limit the number of words that it shows.. ie 100. The code pulling this is: <?php $content = get_the_content('Continued »'); if (strlen($content) > 200 && !eregi("Continued »", $content)) $i++; ?> What do I need to add so that I limit the number of words or characters with a More/Read Full post link. Thanks
<?php $content = get_the_content('Continued »'); if (strlen($content) > 200 && !eregi("Continued »", $content)) $i++; ?> At simple sight i think that you should change the 200 to 100? Anyways i havent read the rest of the code to be sure.
ok I have now got this far. <?php $content = get_the_content('Continued »'); if (strlen($content) > 200 && !eregi("Continued »", $content)) { $content = substr(strip_tags($content), 0, 200) . "..."; } $i++; ?> This reduces the content on the home page to short, however it uses the strip_tags that removes the html so that the Image does not show. Can anyone get me that one step further to show image with the 200 character limit in place. Thanks
Why can't you just use the "read more" tool that is already embedded in the post editor ? It will cut off the post where ever you insert it.