Question Detail

 

How to use substring() function with the_content() in worpress?

I am using this code;

<?php echo substr(the_content(), 0, 5) ?>

but code is not working.


Thread Reply

Manish Kumar

- 1 years ago

You can use this code:

<?php

       $content = get_the_content();
       $content = strip_tags($content);
       echo substr($content, 0, 20);

   ?>