updated   : May 15, 2012
we now have 588 snippets
By : , on December 08, 2011 9:00 am

Disable content editor for specific page template

wordpress snippet

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 more
By : , on November 29, 2011 9:00 am

Restrict user access to specific templates

wordpress snippet

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 more
By : , on September 27, 2011 9:00 am

Display specific content if post has_tag or specific tag

wordpress snippet

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 more
By : , on August 15, 2011 9:00 am

Custom column with currently active page template

wordpress snippet

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 more
By : , on May 31, 2011 9:00 am

Print a list of all supported shortcodes

wordpress snippet

Adding this snippet to your wordpress template will display a list of every shortcode supported by wordpress and your wordpress theme.

read more
By : , on May 06, 2011 9:00 am

Create multiple search templates for custom post types

wordpress snippet

Adding these snippets to your wordpress theme will enable you to setup multiple search templates for custom post types.

read more
By : , on March 18, 2011 9:00 am

Track post views without a plugin using post meta

wordpress snippet

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 more
By : , on December 16, 2010 4:00 pm

Template directory path

wordpress snippet

Adding this PHP code snippet to your wordpress theme will automatically generate the file path to your template directory.

read more