If I put an image at the beginning of the post my content just disappears at the home page. but when I click read more button it shows full content (single.php)


if (strlen(get_the_content()) > 10) {
    $content = get_the_content();
    echo str_replace('&nbsp;', '', substr($content, 0, 50)). "....";

How can I show the content summaryon the home even I add an image at the beginning of the post?

Any help will be very much appreciated....

  • Is there a specific reason you're producing output using the above code instead of utilizing the excerpt or more link functionality feature in WordPress(ie. what does your code aim to solve that default functionality cannot provide).
    – t31os
    Jan 30, 2014 at 11:22
  • ha? I do not get that.. I am using those codes to get post summaries fist 10 lines on my home page.. below the 10 word of post summary there is a read more button. when the users click the read more boutton it goes to the post. means to single.php Jan 30, 2014 at 11:31

1 Answer 1


You should probably use the core function the_excerpt() to avoid this problem. You can customize the length of your automated excerpt (see link below), so there's really no reason to use the function you've used. This problem is probably caused by the str_replace funtion in your code.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.