When you’re working with custom post types, sometimes the post title isn’t a title. It might be a person’s name, a building number, or a course code (just to take a few examples from universities). So it’s great that WordPress has a simple filter that makes it easy to customize the “Enter title here” placeholder text to make it fit your content:
https://gist.github.com/sillybean/e7d54addfa36428cfc3ce61ab171a4a7
Mike Steffel says
Stephanie,
Would it be best practice to have this function in the plugin for your custom post type? Currently we are using several plugins for different items and though it may be handy to have this function in the theme functions file, I’m guessing it is better to have this function reside in each plugin.
As an example, we are developing a news site with the following plugins and content types:
– alerts plugin (campus alerts)
– news plugin (news articles, and press releases)
– spotlights (using the same “spotlight” content type for students, faculty/staff, and employers)
If the function should be in the plugin, we could combine these separate plugins into one where we could use this function once instead of three times. However, we are planning on using the news plugin on other sites, and it would be nice to have the plugin consistent.
Thoughts?
Stephanie Leary says
Hey, Mike. In that situation, I’d use separate filters in each plugin, and maybe replace the switch() with a simple if().