Index: trunk/custom-post-type-ui.php =================================================================== --- trunk/custom-post-type-ui.php (revision 430280) +++ trunk/custom-post-type-ui.php (working copy) @@ -79,10 +79,11 @@ foreach ($cpt_post_types as $cpt_post_type) { //set post type values - $cpt_label = ( !$cpt_post_type["label"] ) ? esc_html($cpt_post_type["name"]) : esc_html($cpt_post_type["label"]); - $cpt_singular = ( !$cpt_post_type["singular_label"] ) ? $cpt_label : esc_html($cpt_post_type["singular_label"]); - $cpt_rewrite_slug = ( !$cpt_post_type["rewrite_slug"] ) ? esc_html($cpt_post_type["name"]) : esc_html($cpt_post_type["rewrite_slug"]); - $cpt_menu_position = ( !$cpt_post_type["menu_position"] ) ? null : intval($cpt_post_type["menu_position"]); + $cpt_label = ( !$cpt_post_type["label"] ) ? esc_html( $cpt_post_type["name"] ) : esc_html( $cpt_post_type["label"] ); + $cpt_singular = ( !$cpt_post_type["singular_label"] ) ? $cpt_label : esc_html( $cpt_post_type["singular_label"] ); + $cpt_rewrite_slug = ( !$cpt_post_type["rewrite_slug"] ) ? esc_html( $cpt_post_type["name"] ) : esc_html( $cpt_post_type["rewrite_slug"] ); + $cpt_menu_position = ( !$cpt_post_type["menu_position"] ) ? null : intval( $cpt_post_type["menu_position"] ); + $cpt_menu_icon = ( !$cpt_post_type["menu_icon"] ) ? null : $cpt_post_type["menu_icon"]; $cpt_taxonomies = ( !$cpt_post_type[1] ) ? array() : $cpt_post_type[1]; $cpt_supports = ( !$cpt_post_type[0] ) ? array() : $cpt_post_type[0]; //$cpt_show_in_menu = ( !$cpt_post_type["show_in_menu_string"] ) ? null : $cpt_post_type["show_in_menu_string"]; @@ -115,22 +116,23 @@ $cpt_labels['not_found_in_trash'] = ( $cpt_post_type[2]["not_found_in_trash"] ) ? $cpt_post_type[2]["not_found_in_trash"] : 'No ' .$cpt_label. ' Found in Trash'; $cpt_labels['parent'] = ( $cpt_post_type[2]["parent"] ) ? $cpt_post_type[2]["parent"] : 'Parent ' .$cpt_singular; - register_post_type( $cpt_post_type["name"], array( 'label' => __($cpt_label), - 'public' => get_disp_boolean($cpt_post_type["public"]), - 'singular_label' => $cpt_post_type["singular_label"], - 'show_ui' => get_disp_boolean($cpt_post_type["show_ui"]), - 'has_archive' => $cpt_has_archive, - 'show_in_menu' => $cpt_show_in_menu, - 'capability_type' => $cpt_post_type["capability_type"], - 'hierarchical' => get_disp_boolean($cpt_post_type["hierarchical"]), - 'rewrite' => array('slug' => $cpt_rewrite_slug), - 'query_var' => get_disp_boolean($cpt_post_type["query_var"]), - 'description' => esc_html($cpt_post_type["description"]), - 'menu_position' => $cpt_menu_position, - 'supports' => $cpt_supports, - 'taxonomies' => $cpt_taxonomies, - 'labels' => $cpt_labels - ) ); + register_post_type( $cpt_post_type["name"], array( 'label' => __( $cpt_label ), + 'public' => get_disp_boolean( $cpt_post_type["public"] ), + 'singular_label' => $cpt_post_type["singular_label"], + 'show_ui' => get_disp_boolean( $cpt_post_type["show_ui"] ), + 'has_archive' => $cpt_has_archive, + 'show_in_menu' => $cpt_show_in_menu, + 'capability_type' => $cpt_post_type["capability_type"], + 'hierarchical' => get_disp_boolean( $cpt_post_type["hierarchical"] ), + 'rewrite' => array( 'slug' => $cpt_rewrite_slug, 'with_front' => $cpt_post_type["rewrite_front"] ), + 'query_var' => get_disp_boolean( $cpt_post_type["query_var"] ), + 'description' => esc_html( $cpt_post_type["description"] ), + 'menu_position' => $cpt_menu_position, + 'menu_icon' => $cpt_menu_icon, + 'supports' => $cpt_supports, + 'taxonomies' => $cpt_taxonomies, + 'labels' => $cpt_labels + ) ); } } } @@ -169,14 +171,14 @@ //register our custom taxonomies register_taxonomy( $cpt_tax_type["name"], $cpt_post_types, - array( 'hierarchical' => get_disp_boolean($cpt_tax_type["hierarchical"]), - 'label' => $cpt_label, - 'show_ui' => get_disp_boolean($cpt_tax_type["show_ui"]), - 'query_var' => get_disp_boolean($cpt_tax_type["query_var"]), - 'rewrite' => array('slug' => $cpt_rewrite_slug), - 'singular_label' => $cpt_singular_label, - 'labels' => $cpt_labels - ) ); + array( 'hierarchical' => get_disp_boolean( $cpt_tax_type["hierarchical"] ), + 'label' => $cpt_label, + 'show_ui' => get_disp_boolean( $cpt_tax_type["show_ui"] ), + 'query_var' => get_disp_boolean( $cpt_tax_type["query_var"] ), + 'rewrite' => array( 'slug' => $cpt_rewrite_slug, 'with_front' => $cpt_tax_type["rewrite_front"] ), + 'singular_label' => $cpt_singular_label, + 'labels' => $cpt_labels + ) ); } } @@ -530,32 +532,34 @@ - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + - - - - - - + + + + + + + @@ -598,82 +603,70 @@ @@ -704,30 +697,30 @@
Delete / Edit / Get Code publish; ?> draft; ?>
- - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + + - - - + + + + @@ -885,7 +881,7 @@ $custom_tax .= '\'label\' => \''.$cpt_label.'\','; $custom_tax .= '\'show_ui\' => '.disp_boolean($cpt_tax_type["show_ui"]).','; $custom_tax .= '\'query_var\' => '. disp_boolean($cpt_tax_type["query_var"]).','; - $custom_tax .= '\'rewrite\' => array(\'slug\' => \'' .$cpt_tax_type["rewrite_slug"]. '\'),'; + $custom_tax .= '\'rewrite\' => array(\'slug\' => \'' .$cpt_tax_type["rewrite_slug"]. '\',\'with_front\' => \'' .$cpt_tax_type["rewrite_front"]. '\'),'; $custom_tax .= '\'singular_label\' => \''.$cpt_singular_label.'\''; $custom_tax .= ') );'; @@ -922,41 +918,44 @@ } -//check if we are editing a custom post type or creating a new one -If (isset($_GET['edittype']) && !isset($_GET['cpt_edit'])) { - check_admin_referer('cpt_edit_post_type'); + //check if we are editing a custom post type or creating a new one + if ( isset( $_GET['edittype'] ) && !isset( $_GET['cpt_edit'] ) ) { + check_admin_referer( 'cpt_edit_post_type' ); - //get post type to edit - $editType = intval($_GET['edittype']); + //get post type to edit + $editType = intval( $_GET['edittype'] ); - //load custom posts saved in WP - $cpt_options = get_option('cpt_custom_post_types'); + //load custom posts saved in WP + $cpt_options = get_option( 'cpt_custom_post_types' ); - //load custom post type values to edit - $cpt_post_type_name = $cpt_options[$editType]["name"]; - $cpt_label = $cpt_options[$editType]["label"]; - $cpt_singular_label = $cpt_options[$editType]["singular_label"]; - $cpt_public = $cpt_options[$editType]["public"]; - $cpt_showui = $cpt_options[$editType]["show_ui"]; - $cpt_capability = $cpt_options[$editType]["capability_type"]; - $cpt_hierarchical = $cpt_options[$editType]["hierarchical"]; - $cpt_rewrite = $cpt_options[$editType]["rewrite"]; - $cpt_rewrite_slug = $cpt_options[$editType]["rewrite_slug"]; - $cpt_query_var = $cpt_options[$editType]["query_var"]; - $cpt_description = $cpt_options[$editType]["description"]; - $cpt_menu_position = $cpt_options[$editType]["menu_position"]; - $cpt_supports = $cpt_options[$editType][0]; - $cpt_taxes = $cpt_options[$editType][1]; - $cpt_labels = $cpt_options[$editType][2]; - $cpt_has_archive = ( isset( $cpt_options[$editType]["has_archive"] ) ) ? $cpt_options[$editType]["has_archive"] : null; - $cpt_show_in_menu = ( isset( $cpt_options[$editType]["show_in_menu"] ) ) ? $cpt_options[$editType]["show_in_menu"] : null; - $cpt_show_in_menu_string = ( isset( $cpt_options[$editType]["show_in_menu_string"] ) ) ? $cpt_options[$editType]["show_in_menu_string"] : null; + //load custom post type values to edit + $cpt_post_type_name = $cpt_options[$editType]["name"]; + $cpt_label = $cpt_options[$editType]["label"]; + $cpt_singular_label = $cpt_options[$editType]["singular_label"]; + $cpt_public = $cpt_options[$editType]["public"]; + $cpt_showui = $cpt_options[$editType]["show_ui"]; + $cpt_capability = $cpt_options[$editType]["capability_type"]; + $cpt_hierarchical = $cpt_options[$editType]["hierarchical"]; + $cpt_rewrite = $cpt_options[$editType]["rewrite"]; + $cpt_rewrite_front = $cpt_options[$editType]["rewrite_front"]; + $cpt_rewrite_slug = $cpt_options[$editType]["rewrite_slug"]; + $cpt_query_var = $cpt_options[$editType]["query_var"]; + $cpt_description = $cpt_options[$editType]["description"]; + $cpt_menu_position = $cpt_options[$editType]["menu_position"]; + $cpt_menu_icon = $cpt_options[$editType]["menu_icon"]; - $cpt_submit_name = 'Save Custom Post Type'; -}Else{ - $cpt_submit_name = 'Create Custom Post Type'; -} + $cpt_supports = $cpt_options[$editType][0]; + $cpt_taxes = $cpt_options[$editType][1]; + $cpt_labels = $cpt_options[$editType][2]; + $cpt_has_archive = ( isset( $cpt_options[$editType]["has_archive"] ) ) ? $cpt_options[$editType]["has_archive"] : null; + $cpt_show_in_menu = ( isset( $cpt_options[$editType]["show_in_menu"] ) ) ? $cpt_options[$editType]["show_in_menu"] : null; + $cpt_show_in_menu_string = ( isset( $cpt_options[$editType]["show_in_menu_string"] ) ) ? $cpt_options[$editType]["show_in_menu_string"] : null; + $cpt_submit_name = 'Save Custom Post Type'; + }else { + $cpt_submit_name = 'Create Custom Post Type'; + } + If (isset($_GET['edittax']) && !isset($_GET['cpt_edit'])) { check_admin_referer('cpt_edit_tax'); @@ -966,23 +965,24 @@ //load custom posts saved in WP $cpt_options = get_option('cpt_custom_tax_types'); - //load custom post type values to edit - $cpt_tax_name = $cpt_options[$editTax]["name"]; - $cpt_tax_label = $cpt_options[$editTax]["label"]; - $cpt_singular_label = $cpt_options[$editTax]["singular_label"]; - $cpt_tax_object_type = ( isset( $cpt_options[$editTax]["cpt_name"] ) ) ? $cpt_options[$editTax]["cpt_name"] : null; - $cpt_tax_hierarchical = $cpt_options[$editTax]["hierarchical"]; - $cpt_tax_showui = $cpt_options[$editTax]["show_ui"]; - $cpt_tax_query_var = $cpt_options[$editTax]["query_var"]; - $cpt_tax_rewrite = $cpt_options[$editTax]["rewrite"]; - $cpt_tax_rewrite_slug = $cpt_options[$editTax]["rewrite_slug"]; - $cpt_tax_labels = $cpt_options[$editTax][0]; - $cpt_post_types = $cpt_options[$editTax][1]; + //load custom post type values to edit + $cpt_tax_name = $cpt_options[$editTax]["name"]; + $cpt_tax_label = $cpt_options[$editTax]["label"]; + $cpt_singular_label = $cpt_options[$editTax]["singular_label"]; + $cpt_tax_object_type = ( isset( $cpt_options[$editTax]["cpt_name"] ) ) ? $cpt_options[$editTax]["cpt_name"] : null; + $cpt_tax_hierarchical = $cpt_options[$editTax]["hierarchical"]; + $cpt_tax_showui = $cpt_options[$editTax]["show_ui"]; + $cpt_tax_query_var = $cpt_options[$editTax]["query_var"]; + $cpt_tax_rewrite = $cpt_options[$editTax]["rewrite"]; + $cpt_tax_rewrite_front = $cpt_options[$editTax]["rewrite_front"]; + $cpt_tax_rewrite_slug = $cpt_options[$editTax]["rewrite_slug"]; + $cpt_tax_labels = $cpt_options[$editTax][0]; + $cpt_post_types = $cpt_options[$editTax][1]; - $cpt_tax_submit_name = 'Save Custom Taxonomy'; -}Else{ - $cpt_tax_submit_name = 'Create Custom Taxonomy'; -} + $cpt_tax_submit_name = 'Save Custom Taxonomy'; + }else { + $cpt_tax_submit_name = 'Create Custom Taxonomy'; + } //flush rewrite rules flush_rewrite_rules(); @@ -1189,6 +1189,16 @@ + + + + + @@ -1215,8 +1225,13 @@ ? Top level page (e.g. 'plugins.php') - ? + ? + + + + + @@ -1433,6 +1448,16 @@ + + + + +
+ ? (default: True) +
? (default: post type name)
?
+ ? (default: True) +
? (default: taxonomy name)