Created
January 10, 2017 17:39
-
-
Save ashleyfae/5c86ac37ce6279da9991f0855d489133 to your computer and use it in GitHub Desktop.
Always show post excerpts
This file contains hidden or 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 | |
/** | |
* Always show an excerpt. | |
* | |
* @param null|array|string $value The value get_metadata() should return - a single metadata value, or an array of values. | |
* @param int $post_id Object ID. | |
* @param string $meta_key Meta key. | |
* @param bool $single Whether to return only the first value of the specified $meta_key. | |
* | |
* @return bool|null|array|string | |
*/ | |
function ag_rcp_always_show_excerpt( $value, $post_id, $meta_key, $single ) { | |
if ( 'rcp_show_excerpt' == $meta_key && $single ) { | |
return true; | |
} | |
return $value; | |
} | |
add_filter( 'get_post_metadata', 'ag_rcp_always_show_excerpt', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment