wordpress snippets last updated   : January 28, 2015
we now have 645 snippets
category functions.php

Create custom terms admin column

wordpress snippet

create-custom-terms-admin-column

This is a simple little snippet that will add your custom terms in an admin column. I added both the filter and action for both posts and pages, feel free to use both or choose one. Add this snippet to the functions.php of your wordpress theme but be sure to change TERM_NAME on this line echo the_terms( $id, 'TERM_NAME', '', ', ' ) in the snippet to the name of your term. You will then see your terms displayed exactly the same way as you see categories displayed within the admin section.

read more

Remove the_post_thumbnail class

wordpress snippet

Have you ever been using the_post_thumbnail( 'thumbnail' ); but wanted to remove the class that is automatically added. Add the following snippet to the functions.php of your wordpress theme to automatically remove any class. Simple but effective,

read more

Show or Hide widgets on specific pages

wordpress snippet

Want to show or hide widgets on specific pages? This is a great little snippet contributed by Joel Worsham that will do just that. You will first need to get the id name of the widget that you wish to define. You can do this be viewing the page source or using a web inspector tool to view the widget id. The current sample is setup to only display the core ‘pages’ widget on the contact page only. Don’t forget that is_page also accepts an array of page names and id’s.

read more

Sharpen Resized WordPress uploaded Images (jpg only)

wordpress snippet

This great snippet by Unsal Korkmaz that will sharpen resized images uploaded to wordpress (jpg only). This is a great way to fix blurry jpg thumbnail images. If you would rather use this as a plugin you can now download it from the WordPress plugin directory.

read more

Set default attachment display settings, alignment, link to, size in wordpress

wordpress snippet

Have you ever wanted to change the default options when inserting media into a post? Setting the default alignment to “left” or the default size to “large” ? This may not appear to be a big deal but if you are constantly changing the settings to the same thing over and over again for each image this is a must have snippet. We are updating the options “image_default_align, image_default_link_type, image_default_size”. Keep in mind that this just changes the default settings of these options within the add media popup. The method we use to update these options can be used for a number of other options including what you can find in this options reference.

read more

Show absolutely all custom fields for each post

wordpress snippet

This snippet will display absolutely all custom fields for each post. Even custom fields you may not even be aware exist like _edit_lock and others. We have Justin Sternberg to thank for writing this snippet that was submitted a while ago as part of his tutorial on wordpress custom fields. Since this snippet is not available other than in the tutorial I figure it should be posted separately.

read more