[wp-trac] [WordPress Trac] #29301: nav menus does not show custom post type options
WordPress Trac
noreply at wordpress.org
Thu Aug 21 17:16:13 UTC 2014
#29301: nav menus does not show custom post type options
-------------------------------+------------------------------
Reporter: caiovncius | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: 3.9.2
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by caiovncius):
Hi, SergeyBiryukov
folows my code:
{{{
// start register custom post types
add_action('init', 'wdl_register_post_type_courses');
/**
* Register Post types
*
* @return void
*/
function wdl_register_post_type_courses() {
/**
* Post type Courses
*/
$labels = array(
'name' => _x( 'Courses', 'post type
general name'),
'singular_name' => _x( 'Courses', 'post type
singular name'),
'menu_name' => _x( 'Courses', 'admin menu',
'wordle'),
'name_admin_bar' => _x( 'New Course', 'add new on
admin bar', 'wordle'),
'add_new' => _x( 'New Course', 'courses' ),
'add_new_item' => __( 'New Course', 'courses',
'wordle'),
'new_item' => __( 'New Course', 'wordle' ),
'edit_item' => __( 'Edit Course', 'wordle'),
'view_item' => __( 'View Course', 'wordle'),
'all_items' => __( 'All Courses', 'wordle' ),
'search_items' => __( 'Search Course', 'wordle'),
'parent_item_colon' =>'' ,
'not_found' => __( 'Courses not found.',
'wordle'),
'not_found_in_trash' => __( 'Courses not found in
trash.', 'wordle' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'description' => 'WpCursos - Gerenciador de
cursos',
'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,
'rewrite' => array( 'slug' => 'courses' ),
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type('courses', $args);
/**
* Post Types Enrols
*/
$labelsEnrols = array(
'name' => _x( 'Enrols', 'post type
general name'),
'singular_name' => _x( 'Enrol', 'post type
singular name'),
'menu_name' => _x( 'Enrols', 'admin menu',
'wordle'),
'name_admin_bar' => _x( 'New Enrol', 'add new on
admin bar', 'wordle'),
'add_new' => _x( 'New Enrol', 'courses' ),
'add_new_item' => __( 'New Enrol', 'courses',
'wordle'),
'new_item' => __( 'New Enrol', 'wordle' ),
'edit_item' => __( 'Edit Enrol', 'wordle'),
'view_item' => __( 'View Enrol', 'wordle'),
'all_items' => __( 'All Enrols', 'wordle' ),
'search_items' => __( 'Search Enrol', 'wordle'),
'parent_item_colon' =>'' ,
'not_found' => __( 'Enrols not found.',
'wordle'),
'not_found_in_trash' => __( 'Enrols not found in
trash.', 'wordle' ),
);
$argsEnrols = array(
'labels' => $labelsEnrols,
'hierarchical' => true,
'description' => 'Wordle Course Enrols',
'supports' => array(
'comments'
),
'public' => true,
'show_ui' => true,
'show_in_menu' => false,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'enrol' ),
'can_export' => true,
'rewrite' => true,
'menu_position' => null,
'capability_type' => 'post'
);
*/
/**
* Post type Classes
*/
$labelsClasses = array(
'name' => _x( 'Classes', 'post type
general name'),
'singular_name' => _x( 'Classes', 'post type
singular name'),
'menu_name' => _x( 'Classes', 'admin menu',
'wordle'),
'name_admin_bar' => _x( 'New Class', 'add new on
admin bar', 'wordle'),
'add_new' => _x( 'New Classes', 'courses' ),
'add_new_item' => __( 'New Classes', 'courses',
'wordle'),
'new_item' => __( 'New Classes', 'wordle' ),
'edit_item' => __( 'Edit Classes', 'wordle'),
'view_item' => __( 'View Classes', 'wordle'),
'all_items' => __( 'All Classes', 'wordle' ),
'search_items' => __( 'Search Class', 'wordle'),
'parent_item_colon' =>'' ,
'not_found' => __( 'Classes not found.',
'wordle'),
'not_found_in_trash' => __( 'Classes not found in
trash.', 'wordle' ),
);
$argsClasses = array(
'labels' => $labelsClasses,
'hierarchical' => true,
'description' => 'Wordle Course Classes',
'supports' => array(
'title',
'editor'
),
'public' => true,
'show_ui' => true,
'show_in_menu' => false,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'classes' ),
'can_export' => true,
'rewrite' => true,
'menu_position' => null,
'capability_type' => 'post'
);
register_post_type('courses', $args);
register_post_type('enrols', $argsEnrols);
register_post_type('courseclass', $argsClasses);
}
/**
* Flush rewrite urls
*
* @return void
*/
function wdl_courses_rewrite_flush()
{
wdl_register_post_type_courses();
flush_rewrite_rules();
}
// hook wordpress
register_activation_hook( __FILE__, 'wdl_courses_rewrite_flush' );
// start register taxonomies
add_action('init', 'wdl_register_taxonomy_course');
/**
* Create taxonomies to Woordle
*
* @return void
*/
function wdl_register_taxonomy_course()
{
$labels = array(
'name' => _x('Courses
Categories', 'wordle'),
'singular_name' => _x('Courses Category',
'taxonomy singular name'),
'search_items' => _x('Search Course Category',
'search category'),
'all_items' => _x('All Courses
Categories', 'All Categories'),
'parent_item' => _x('Parent Course Category',
'parent category'),
'parent-item_colon' => _x('Parent Course Category',
'parent category column'),
'edit_item' => _x('Edit Course
Category', 'Edit course category'),
'update_item' => _x('Update Course Category',
'update course category'),
'add_new_item' => _x('New Course Category', 'add
new category'),
'new_item_name' => _x('New Course Category', 'new
course category'),
'menu_name' => _x('Course Categories',
'courses categories'),
);
$args = array(
'public' => true,
'hierarchical' => true,
'has_archive' => true,
'labels' => $labels,
'menu_position' => true,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'show_in_nav_menus' => true,
'show_admin_column' => true,
'show_in_menu' => true,
'can_export' => true,
'rewrite' => true,
'query_var' => true,
'rewrite' => array(
'slug' =>
'catcourse'
),
);
register_taxonomy('catcourse', array('courses'), $args);
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29301#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list