wordpress snippets last updated   : October 6, 2014
we now have 641 snippets

Add body_class to page templates in wordpress

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will let you add a body_class based on a specific page template.

read more

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

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

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

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

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
jqsnipp.com | we just launched jquery snippets website