Skip to content

Instantly share code, notes, and snippets.

@sododesign
Last active February 10, 2016 18:17
Show Gist options
  • Save sododesign/e2d94bfc983dac7a2157 to your computer and use it in GitHub Desktop.
Save sododesign/e2d94bfc983dac7a2157 to your computer and use it in GitHub Desktop.
WORDPRESS GET EXCERPT
<?php
/*-----------------------------------------------------------------------------------*/
// EXCERPT SIZE
/*-----------------------------------------------------------------------------------*/
function get_excerpt() {
$output = substr(get_the_excerpt(), 0,85);
$output = apply_filters('wptexturize', $output);
$output = apply_filters('convert_chars', $output);
$output = $output;
echo $output . '<span class="excerptdots">...</span>';
}
// GET TITLE SMALL WORDS
function get_small_title($word_limit) {
$title = get_the_title();
$output = explode(" ", $title);
$output = apply_filters('wptexturize', $output);
$output = apply_filters('convert_chars', $output);
$output = $output;
return implode(" ", array_splice($output,0,$word_limit));
}
// IN TEMPLATE
echo get_small_title(5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment