wordpress snippets last updated   : April 22, 2014
we now have 631 snippets

Add a Class to ‘the_post_thumbnail’ a Featured Image

wordpress snippet

When adding a featured image to a template, you may want to add a class to the image tag that is being generated. This extra class will allow you to use CSS to format it better.

read more

Prepend ‘Sponsored post:’ to post title using post_meta

wordpress snippet

Simple little snippet that will use a custom field sponsored set to true will prepend “‘Sponsored post:” to the_title. The second snippet will prepend the value of sponsored to the_title.

read more

Change admin post/page color by status – draft, pending, published, future, private

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will change the background colors of the post / page within the admin based on the current status. Draft, Pending, Published, Future, Private.

read more

Dynamically create and attach sidebars to pages or posts

wordpress snippet

This is a bit large for the snippets I normally post however very useful. This snippet will let you easily create new sidebars by simply adding the name to an array. You will also be able to define the dynamically created sidebar a page loads by selecting from the custom sidebar selection metabox.

read more

Add custom field automatically when post or page is publish

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will add a custom field to a post or page when published. Don’t forget to update the FIELD_NAME and the CUSTOM VALUE.

read more

Post is older than

wordpress snippet

Adding this first block of code to your functions.php will allow you to check the age of a post to see if it is older than a set number of days. Great if you want to display some some information related to the post after set number of days or even stop displaying the post altogether.

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