Last active
August 29, 2015 14:14
-
-
Save mrbobbybryant/742dd80725c95da96b57 to your computer and use it in GitHub Desktop.
Change the default WordPress title placeholder text
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
<?php | |
//If you only need to change one use this version. | |
function dwwp_change_title( $title_placeholder) { | |
$screen = get_current_screen(); | |
if ( $screen->post_type == 'job' ) { //<--Your post type name goes here. | |
$title_placeholder = 'I changed the title yo'; | |
} | |
return $title_placeholder; | |
} | |
add_filter( 'enter_title_here', 'dwwp_change_title' ); | |
//To change multiple placeholder titles, a switch statement is better. | |
function dwwp_change_title( $title_placeholder) { | |
$screen = get_current_screen(); | |
switch ($title_placeholder) { | |
case ( $screen->post_type == 'metabox' ): | |
return $title_placeholder = 'metabox title'; | |
break; | |
case ( $screen->post_type == 'job' ): | |
return $title_placeholder = 'job title'; | |
break; | |
default: | |
return $title_placeholder; | |
} | |
} | |
add_filter( 'enter_title_here', 'dwwp_change_title' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment