wordpress snippets last updated   : July 14, 2014
we now have 634 snippets

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

Adding this snippet to the functions.php of your wordpress theme will add a select menu with a list of all custom fields, just select the field you want to filter by and click the filter button.

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

Get custom field value with shortcode

wordpress snippet

Adding this PHP code to the functions.php of your wordpress theme will enable you to get custom field values using shortcode.

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