Custom Post Type -
<code>
function home_custom_slider() {
$labels = array(
'name' => _x('Slider', 'post type general name', 'your_text_domain'),
'singular_name' => _x('Slides', 'post type singular name', 'your_text_domain'),
'add_new' => _x('Add New', 'Slides', 'your_text_domain'),
'add_new_item' => __('Add New Slides', 'your_text_domain'),
'edit_item' => __('Edit Slides', 'your_text_domain'),
'new_item' => __('New Slides', 'your_text_domain'),
'all_items' => __('All Slides', 'your_text_domain'),
'view_item' => __('View Slides', 'your_text_domain'),
'search_items' => __('Search Slides', 'your_text_domain'),
'not_found' => __('No Slides found', 'your_text_domain'),
'not_found_in_trash' => __('No Slides found in Trash', 'your_text_domain'),
'parent_item_colon' => '',
'menu_name' => __('Home Slider', 'your_text_domain')
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => _x( 'slides', 'URL slug', 'your_text_domain' ) ),
'capability_type' => 'post',
'menu_icon' => get_stylesheet_directory_uri() . '/images/icon_slides.png',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail','custom-fields','page-attributes')
);
register_post_type('Slides', $args);
}
add_action( 'init', 'home_custom_slider' );
add_image_size( 'slider-post-thumbnail', 775, 452, true ); // Slider Thumbnail
</code>
<code>
function home_custom_slider() {
$labels = array(
'name' => _x('Slider', 'post type general name', 'your_text_domain'),
'singular_name' => _x('Slides', 'post type singular name', 'your_text_domain'),
'add_new' => _x('Add New', 'Slides', 'your_text_domain'),
'add_new_item' => __('Add New Slides', 'your_text_domain'),
'edit_item' => __('Edit Slides', 'your_text_domain'),
'new_item' => __('New Slides', 'your_text_domain'),
'all_items' => __('All Slides', 'your_text_domain'),
'view_item' => __('View Slides', 'your_text_domain'),
'search_items' => __('Search Slides', 'your_text_domain'),
'not_found' => __('No Slides found', 'your_text_domain'),
'not_found_in_trash' => __('No Slides found in Trash', 'your_text_domain'),
'parent_item_colon' => '',
'menu_name' => __('Home Slider', 'your_text_domain')
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => _x( 'slides', 'URL slug', 'your_text_domain' ) ),
'capability_type' => 'post',
'menu_icon' => get_stylesheet_directory_uri() . '/images/icon_slides.png',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail','custom-fields','page-attributes')
);
register_post_type('Slides', $args);
}
add_action( 'init', 'home_custom_slider' );
add_image_size( 'slider-post-thumbnail', 775, 452, true ); // Slider Thumbnail
</code>
No comments:
Post a Comment