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

Add post category to body_class on single posts

wordpress snippet

This little snippet will take all the categories assigned to a post and add them to the body_class “sgl-cat-{category-name}”.

read more

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

Setup whitelist body_class to remove unwanted classes

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will let you create a white-list of terms to include in body_class. This is a great way to filter out many of the unwanted classes added

read more

Add custom body_class to all post and pages

wordpress snippet

This is similar to another body_class post I made however I had a few emails asking about just adding a specific class to the body on every page. Adding this snippet to the functions.php of your wordpress theme will let you add specific classes to wordpress body_class function. Don’t forget to add <?php body_class(); ?> to the body tag within header.php.

read more
jqsnipp.com | we just launched jquery snippets website