Skip to content

Instantly share code, notes, and snippets.

@aslamhindko
Last active July 11, 2016 15:08
Show Gist options
  • Save aslamhindko/87f4c173556c521f58e99cc2ecabcc34 to your computer and use it in GitHub Desktop.
Save aslamhindko/87f4c173556c521f58e99cc2ecabcc34 to your computer and use it in GitHub Desktop.
Register For Post Type
(ye post type ki registertation hain)
<?php /**
* Registers a new post type
* @uses $wp_post_types Inserts new post type object into the list
*
* @param string Post type key, must not exceed 20 characters
* @param array|string See optional args description above.
* @return object|WP_Error the registered post type object, or an error object
*/
function slider() {
$labels = array(
'name' => __( 'Slider', 'text-domain' ),
'singular_name' => __( 'slider', 'text-domain' ),
'add_new' => _x( 'Add New slider', 'text-domain', 'text-domain' ),
'add_new_item' => __( 'Add New slider', 'text-domain' ),
'edit_item' => __( 'Edit slider', 'text-domain' ),
'new_item' => __( 'New slider', 'text-domain' ),
'view_item' => __( 'View slider', 'text-domain' ),
'search_items' => __( 'Search Slider', 'text-domain' ),
'not_found' => __( 'No Slider found', 'text-domain' ),
'not_found_in_trash' => __( 'No Slider found in Trash', 'text-domain' ),
'parent_item_colon' => __( 'Parent slider:', 'text-domain' ),
'menu_name' => __( 'Slider', 'text-domain' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'description' => 'description',
'taxonomies' => array(),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_admin_bar' => true,
'menu_position' => null,
'menu_icon' => null,
'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',
'supports' => array(
'title', 'editor', 'author', 'thumbnail',
'excerpt','custom-fields', 'trackbacks', 'comments',
'revisions', 'page-attributes', 'post-formats'
)
);
register_post_type( 'slider', $args );
}
add_action( 'init', 'slider' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment