Created
November 6, 2013 15:07
-
-
Save JiveDig/7337562 to your computer and use it in GitHub Desktop.
Change custom post type "Enter title here" text
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
// Change the "Enter title here" to "Enter book title here" for Books | |
add_filter('gettext', 'book_custom_rewrites', 10, 4); | |
function book_custom_rewrites($translation, $text, $domain) { | |
global $post; | |
if ( ! isset( $post->post_type ) ) { | |
return $translation; | |
} | |
$translations = &get_translations_for_domain($domain); | |
$translation_array = array(); | |
switch ($post->post_type) { | |
case 'books': // enter your post type name here | |
$translation_array = array( | |
'Enter title here' => 'Enter book title here' | |
); | |
break; | |
} | |
if (array_key_exists($text, $translation_array)) { | |
return $translations->translate($translation_array[$text]); | |
} | |
return $translation; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment