Skip to content

Instantly share code, notes, and snippets.

@shahadat014
Last active August 29, 2015 14:22
Show Gist options
  • Save shahadat014/bf1f34436f76f7e22d7d to your computer and use it in GitHub Desktop.
Save shahadat014/bf1f34436f76f7e22d7d to your computer and use it in GitHub Desktop.
metabox cmb2 total fields links ,, create custom post taxonomy(category support)
https://github.com/WebDevStudios/CMB2/wiki/Field-Types
http://metabox.io/(another metabox link)
Most important create custom post taxonomy(category support)
if ( ! function_exists( 'storyteller_theme_custom_posts_taxonomy' ) ) :
function storyteller_theme_custom_posts_taxonomy() {
register_taxonomy(
'event_cat', //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
'event', //post type name
array(
'hierarchical' => true,
'label' => 'Event Category', //Display name
'query_var' => true,
'show_admin_column' => true,
'rewrite' => array(
'slug' => 'event-category', // This controls the base slug that will display before each term
'with_front' => false // Don't display the category base before
)
)
);
}
add_action( 'init', 'storyteller_theme_custom_posts_taxonomy');
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment