Last active
February 10, 2016 18:17
-
-
Save sododesign/e2d94bfc983dac7a2157 to your computer and use it in GitHub Desktop.
WORDPRESS GET EXCERPT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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