Slider Post Type
// Register Custom Post Type
function slider_post_type() {
$labels = array(
'name' => _x( 'Sliders', 'Post Type General Name', 'td_forcon' ),
'singular_name' => _x( 'Slider', 'Post Type Singular Name', 'td_forcon' ),
'menu_name' => __( 'Slider', 'td_forcon' ),
'parent_item_colon' => __( 'Parent Slider:', 'td_forcon' ),
'all_items' => __( 'All Sliders', 'td_forcon' ),
'view_item' => __( 'View Slider', 'td_forcon' ),
'add_new_item' => __( 'Add New Slider', 'td_forcon' ),
'add_new' => __( 'New Slider', 'td_forcon' ),
'edit_item' => __( 'Edit Slider', 'td_forcon' ),
'update_item' => __( 'Update Slider', 'td_forcon' ),
'search_items' => __( 'Search sliders', 'td_forcon' ),
'not_found' => __( 'No slider found', 'td_forcon' ),
'not_found_in_trash' => __( 'No sliders found in Trash', 'td_forcon' ),
);
$args = array(
'label' => __( 'slider', 'td_forcon' ),
'description' => __( 'Slider to homepage', 'td_forcon' ),
'labels' => $labels,
'supports' => array( 'title', 'excerpt', 'thumbnail', 'custom-fields', ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-format-gallery',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'slider', $args );
}
// Hook into the 'init' action
add_action( 'init', 'slider_post_type', 0 );