Skip to content

Instantly share code, notes, and snippets.

@doubleedesign
Created September 5, 2018 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doubleedesign/c5a52d770974d19c3943322374d79b0f to your computer and use it in GitHub Desktop.
Save doubleedesign/c5a52d770974d19c3943322374d79b0f to your computer and use it in GitHub Desktop.
Change the explanatory text in the WordPress excerpt meta box, according to post type.
/**
* Change the excerpt explanation in the backend
* @param $translated_text
* @param $text
* @param $domain
*
* @return string
*/
function doublee_change_excerpt_explanation( $translated_text, $text, $domain ) {
$post_type = get_post_type();
switch ($translated_text) {
case 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.' :
if($post_type == 'page') {
$translated_text = '';
break;
}
if($post_type == 'post') {
$translated_text = 'Used for the lead paragraph at the top of the page, and for preview text in search results.';
break;
}
}
return $translated_text;
}
add_filter( 'gettext', 'doublee_change_excerpt_explanation', 20, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment