You appear to be a bot. Output may be restricted
Description
Implements "get_the_excerpt" for oik-shortcodesWordPress SEO ( Yoast SEO ) has a nasty habit of asking for the Excerpt if you don't set a Meta description. This can invoke a whole bunch of filters. We don't need this. While it's quite easy to type the Meta description when you hand create content, it may not be created for automatically generated stuff.
- This filter will return an excerpt either from the excerpt or the part of the content before any <!–more comment
- This allows for <!–more
- It doesn't allow for <!–page or <!–noteaser
- If there isn't a <!–more tag we return the full post content.
- That can be dealt with by the subsequent filters.
Usage
$string = oik_get_the_excerpt( $excerpt, $post );
Parameters
- $excerpt
- ( string|null ) optional – The current value for the excerpt.
- $post
- ( object|null ) optional – The post from which the excerpt has been extracted.
Returns
string the excerpt we think will doSource
File name: oik-shortcodes/oik-shortcodes.phpLines:
1 to 17 of 17
function oik_get_the_excerpt( $excerpt=null, $post=null ) { if ( !$excerpt ) { if ( $post ) { if ( $post->post_excerpt ) { $excerpt = $post->post_excerpt; } else { $pos_more = strpos( $post->post_content, "<!--more" ); if ( false !== $pos_more ) { $excerpt = substr( $post->post_content, 0, $pos_more ); } else { $excerpt = $post->post_content; } } } } return $excerpt; }View on GitHub