Disable content editor for specific page template
Adding this snippet to the functions.php of your wordpress theme will disable the content editor when a page is using a specific template. Don’t forget to change the name of the template file on line 08 this sample I have submit.php but can be changed to anything.
read moreRestrict user access to specific templates
This is a slight modification of a great little snippet by Elliott Richmond I just changed “include” to “get_template_part”. Create a new template file and drop in this snippet and you can restrict user access to this template. Don’t forget to change the template name at the top. You will of course also need to create a template file called error.php or the other option is to use something like “wp_die(‘You don’t have access.’)” instead of loading a template.
read moreDisplay specific content if post has_tag or specific tag
Adding this snippet within the loop of your wordpress template will let you display specific content if a post has tags or not. Also note that has_tag(‘tag_name’) suports, tag name, term_id or slug and an array of tag names, term ids and slugs. Also a big thanks to Jeremy for submitting the following.
read morethis months featured snippets
Custom column with currently active page template
Adding this snippet to the functions.php of your wordpress theme will add a column to your admin pages showing which wordpress page template currently in use.
read morePrint a list of all supported shortcodes
Adding this snippet to your wordpress template will display a list of every shortcode supported by wordpress and your wordpress theme.
read moreCreate multiple search templates for custom post types
Adding these snippets to your wordpress theme will enable you to setup multiple search templates for custom post types.
read moreTrack post views without a plugin using post meta
Add this snippet into the functions.php of your wordpress theme then follow step 1. and step 2. to display the number of views for each post.
read moreTemplate directory path
Adding this PHP code snippet to your wordpress theme will automatically generate the file path to your template directory.
read more











