wp trim function

Posted by Juliver Galleto on Stack Overflow See other posts from Stack Overflow or by Juliver Galleto
Published on 2012-10-15T22:40:39Z Indexed on 2012/10/15 23:02 UTC
Read the original article Hit count: 118

Filed under:
|
|

Ok i have this code currently.

<?php

query_posts('category_name=widgets2');

echo "<div id='widgets-wrapper2'><div id='marginwidgets' style='overflow: auto; max-    width: 100%; height: 450px; max-height: 100%; margin: 0 auto;'>";
while (have_posts()) : the_post();
echo "<div class='thewidgets2'>";

echo wp_trim_words( the_content(), $num_words = 0, $more = "..." );

echo '<div style="height: 20px;"></div><a class="button2"     href="'.get_permalink().'">Read More</a></div>';
endwhile;
echo "</div></div>";

?>

as you can see, it gets all the post from the category name widgets2 and then it should display it.

and this line

echo wp_trim_words( the_content(), $num_words = 100, $more = "..." );

should trim the words from the_content() to 100 and add a excerpt at the end character but unfortunately it doesnt work, instead it just display the entire contents that looks untrim at all.

Hope someone here could figured out. Im open in any suggestions, recommendations and all relevant ideas, thank you.

© Stack Overflow or respective owner

Related posts about php

Related posts about html