Wednesday, 28 May 2014
Thursday, 1 May 2014
Custom Post type
Add this following code in your function.php file in to the theme
/******************************************************/
add_action( 'init', 'register_cpt_event' );
function register_cpt_event() {
$labels = array(
'name' => _x( 'events', 'event' ),
'singular_name' => _x( 'event', 'event' ),
'add_new' => _x( 'Add New', 'event' ),
'add_new_item' => _x( 'Add New event', 'event' ),
'edit_item' => _x( 'Edit event', 'event' ),
'new_item' => _x( 'New event', 'event' ),
'view_item' => _x( 'View event', 'event' ),
'search_items' => _x( 'Search events', 'event' ),
'not_found' => _x( 'No events found', 'event' ),
'not_found_in_trash' => _x( 'No events found in Trash', 'event' ),
'parent_item_colon' => _x( 'Parent event:', 'event' ),
'menu_name' => _x( 'events', 'event' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'description' => 'new event',
'supports' => array( 'title', 'editor', 'thumbnail' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'event', $args );
}
/**************************************************************/
/******************************************************/
add_action( 'init', 'register_cpt_event' );
function register_cpt_event() {
$labels = array(
'name' => _x( 'events', 'event' ),
'singular_name' => _x( 'event', 'event' ),
'add_new' => _x( 'Add New', 'event' ),
'add_new_item' => _x( 'Add New event', 'event' ),
'edit_item' => _x( 'Edit event', 'event' ),
'new_item' => _x( 'New event', 'event' ),
'view_item' => _x( 'View event', 'event' ),
'search_items' => _x( 'Search events', 'event' ),
'not_found' => _x( 'No events found', 'event' ),
'not_found_in_trash' => _x( 'No events found in Trash', 'event' ),
'parent_item_colon' => _x( 'Parent event:', 'event' ),
'menu_name' => _x( 'events', 'event' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'description' => 'new event',
'supports' => array( 'title', 'editor', 'thumbnail' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'event', $args );
}
/**************************************************************/
Subscribe to:
Posts (Atom)