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

Check for post type within loop using get_post_type

wordpress snippet

Adding this snippet within the loop of your wordpress theme will let you conditionally check for a specific post type. Just change the post type ‘products’ or ‘people’ to the post type you would like.

read more

Display custom post type menu as submenu

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will add a new custom post type however you may notice the ‘show_in_menu’ => ‘edit.php’,. This option will display the custom post type as a submenu within the post edit menu.

read more

Add custom post types to your sites main RSS feed

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will include the specified custom post types within your primary RSS feed.

read more

Create multiple search templates for custom post types

wordpress snippet

Adding these snippets to your wordpress theme will enable you to setup multiple search templates for custom post types.

read more

Change custom post type icon for new and edit post pages

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will change the default icon on the post edit and new post pages. Don’t forget to change the URL on line 9 to the location of your 24px by 24px icon.

read more

Change the custom post type icon for admin menu

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will create a custom post type products. On line 10 of this snippet we have menu_icon change the URL to the location of your 16px by 16px icon to display in the admin menu.

read more