Skip to content Skip to sidebar Skip to footer

Mb_substr Cutting Off Words In Post Excerpt?

This is the code I am using to show html formatting on my wordpress post excerpts: function get_excerpt($post, $ln){ if (!empty($post->post_excerpt)) { if (

Solution 1:

If you can guarantee that there will be a "." in your text then you can just do this:

echo strtok("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet egestas lacus. Maecenas posuere dolor vitae ultrices viverra.",".");

This will output: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"

strtok manual page

Post a Comment for "Mb_substr Cutting Off Words In Post Excerpt?"