For many websites, we use custom post types for unique content. When a client creates a new post type, maybe it’s a new testimonial or a new project, the default text for the title says ‘Enter title here’.
This may not represent what’s expected. For example for testimonials, we want the client name to be entered. So we want it to say ‘Enter Client here’ instead. This way it’s clear that they should enter the client name.
To make this happen, we add the following code to our functions.php file for each custom post type title placeholder text we’d like changed. Now when our client adds a testimonial or project, we display placeholder text specifying what’s expected.
// Change placeholder default text for custom post type titles add_filter( 'enter_title_here', 'nje_title_placeholders' ); function nje_title_placeholders( $placeholder ){ $screen = get_current_screen(); switch ( $screen->post_type ) { case 'portfolio': $placeholder = 'Enter Project title'; break; case 'testimonial': $placeholder = 'Enter Client name'; break; default: break; } return $placeholder; }




by Norm Euker