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

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

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

Add select menu to filter by custom field in admin

wordpress snippet

WordPress is full of some great features, although sometimes you need to add something extra like the following snippet making WordPress just a little easier to use. This snippet will add a new custom field select menu to your WordPress post, page listings. The menu will display a list of all custom fields, just select the field you want to filter by. This snippet is only for the wp-admin however If you wanted to do any sort of filtering on the front end of your site. View the following snippet that will let you filter by category using search.

read more

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

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

Get custom fields globally

wordpress snippet

Adding this to the functions.php of your wordpress theme will allow you to get custom field values globally great form themes that use a lot of custom fields.

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