Created
September 5, 2018 02:37
-
-
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.
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
/** | |
* 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