Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created June 5, 2012 16:47
Show Gist options
  • Save billerickson/2876185 to your computer and use it in GitHub Desktop.
Save billerickson/2876185 to your computer and use it in GitHub Desktop.
Truncate by word or character
<?php
// Trims by word
wp_trim_words( $text, $num_words, $moretext );
// Trims by character (and strips HTML)
wp_html_excerpt( $str, $num_char );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment