Skip to content

Instantly share code, notes, and snippets.

@Venugopal155
Created June 29, 2016 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Venugopal155/4fbca96da03c80fbfe23f9f030481958 to your computer and use it in GitHub Desktop.
Save Venugopal155/4fbca96da03c80fbfe23f9f030481958 to your computer and use it in GitHub Desktop.
Custom post type register in wordpress
<?php
function amas_register() {
$labels = array(
'name' => _x('AMAs', 'post type general name'),
'singular_name' => _x('AMAs', 'post type singular name'),
'add_new' => _x('Add AMA', 'AMAs'),
'add_new_item' => __('Add New AMA'),
'edit_item' => __('Edit AMA'),
'new_item' => __('New AMA'),
'view_item' => __('View AMA'),
'search_items' => __('Search AMA'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'amas', 'with_front' => false ),
// 'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
//'menu_icon' => '',
'menu_position' => 8,
'supports' => array('title','editor','thumbnail','custom-fields')
);
register_post_type( 'amas' , $args );
flush_rewrite_rules();
}
add_action('init', 'amas_register');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment