updated   : May 15, 2012
we now have 588 snippets
category custom field
By : , on January 16, 2012 9:00 am

Remove support for specific post type features

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will remove support for the specific features bellow from specified post types. Change the word ‘post’ to anything you like including a custom post type name or the default post, page.

read more
By : , on December 12, 2011 9:00 am

Attach images with simple thumbnail selection metabox

wordpress snippet

A little snippet I wrote recently to easily attach images to posts with a simple thumbnail selection metabox. Add the first snippet to the functions.php of your wordress theme. Place the second snippet within the loop of your wordpress theme to display the images in your posts or pages.

read more
By : , on September 30, 2011 9:00 am

Attach PDF files to post with custom metabox file selection

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will create a new metabox within your post editing screen with a select menu listing all PDF files. Adding the second snippet in your wordpress template in the location you wish to display the files URL.

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

Display hidden custom field _values

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will allow you to display hidden custom field values. When a custom field value is prefixed within an underscore _value it will not be displayed, using this snippet will display them temporarily.

read more
By : , on June 15, 2011 9:00 am

Display custom field value of previous and next post

wordpress snippet

Adding this snippet within the loop of your wordpress theme will display the custom field value from the previous and next posts. Just change the CUSTOM_FIELD on line 4 and 5 to the name of the custom field you wish to display.

read more
By : , on June 14, 2011 9:00 am

How to display multiple custom field values

wordpress snippet

Adding this snippet within the loop of your wordpress theme will let you display multiple instances of a custom field value.

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

Define a specific sidebar using custom fields

wordpress snippet

Many of you know WordPress will let you create custom sidebar templates using the same file naming method as other templates eg: sidebar-{name}.php. Replacing the get_sidebar() function with this snippet will let you define a custom sidebar for specific posts using custom fields.

For more details on sidebar templates via this document, http://codex.wordpress.org/Function_Reference/get_sidebar

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

Explode custom field into list

wordpress snippet

Add this snippet to the index.php or single.php of your wordpress theme, I use this currently within the single.php when I have multiple sources that I need to display for a single article. On line 1 you will need to change the name CUSTOM_FIELD_NAME to the name of your custom field. This snippet will explode each newline in a separate list item with the URL as both the href and the name.

read more