• Resolved landwire

    (@landwire)


    Would you mind adding the “hierarchical” thing as below in the code to the plugin?
    I marked my additions with SASCHA CORE HACK. I’m sure I asked before, but I could not see the changes in the changelog. Maybe you think it’s a bad idea?

    //set custom taxonomy values
    			$cpt_label              = ( !empty( $cpt_tax_type["label"] ) ) ? esc_html( $cpt_tax_type["label"] ) : esc_html( $cpt_tax_type["name"] );
    			$cpt_singular_label     = ( !empty( $cpt_tax_type["singular_label"] ) ) ? esc_html( $cpt_tax_type["singular_label"] ) : esc_html( $cpt_tax_type["name"] );
    			$cpt_rewrite_slug       = ( !empty( $cpt_tax_type["rewrite_slug"] ) ) ? esc_html( $cpt_tax_type["rewrite_slug"] ) : esc_html( $cpt_tax_type["name"] );
    			// SASCHA CORE HACK
    			$cpt_rewrite_hierarchical       = ( !empty( $cpt_tax_type["rewrite_hierarchical"] ) ) ? esc_html( $cpt_tax_type["rewrite_hierarchical"] ) : false;
    			// END
    			$cpt_tax_show_admin_column = ( !empty( $cpt_tax_type["show_admin_column"] ) ) ? esc_html( $cpt_tax_type["show_admin_column"] ) : false;
    			$cpt_post_types         = ( !empty( $cpt_tax_type[1] ) ) ? $cpt_tax_type[1] : $cpt_tax_type["cpt_name"];
    
    			//set custom label values
    			$cpt_labels['name']                         = $cpt_label;
    			$cpt_labels['singular_name']                = $cpt_tax_type["singular_label"];
    			$cpt_labels['search_items']                 = ( $cpt_tax_type[0]["search_items"] ) ? $cpt_tax_type[0]["search_items"] : 'Search ' .$cpt_label;
    			$cpt_labels['popular_items']                = ( $cpt_tax_type[0]["popular_items"] ) ? $cpt_tax_type[0]["popular_items"] : 'Popular ' .$cpt_label;
    			$cpt_labels['all_items']                    = ( $cpt_tax_type[0]["all_items"] ) ? $cpt_tax_type[0]["all_items"] : 'All ' .$cpt_label;
    			$cpt_labels['parent_item']                  = ( $cpt_tax_type[0]["parent_item"] ) ? $cpt_tax_type[0]["parent_item"] : 'Parent ' .$cpt_singular_label;
    			$cpt_labels['parent_item_colon']            = ( $cpt_tax_type[0]["parent_item_colon"] ) ? $cpt_tax_type[0]["parent_item_colon"] : 'Parent ' .$cpt_singular_label. ':';
    			$cpt_labels['edit_item']                    = ( $cpt_tax_type[0]["edit_item"] ) ? $cpt_tax_type[0]["edit_item"] : 'Edit ' .$cpt_singular_label;
    			$cpt_labels['update_item']                  = ( $cpt_tax_type[0]["update_item"] ) ? $cpt_tax_type[0]["update_item"] : 'Update ' .$cpt_singular_label;
    			$cpt_labels['add_new_item']                 = ( $cpt_tax_type[0]["add_new_item"] ) ? $cpt_tax_type[0]["add_new_item"] : 'Add New ' .$cpt_singular_label;
    			$cpt_labels['new_item_name']                = ( $cpt_tax_type[0]["new_item_name"] ) ? $cpt_tax_type[0]["new_item_name"] : 'New ' .$cpt_singular_label. ' Name';
    			$cpt_labels['separate_items_with_commas']   = ( $cpt_tax_type[0]["separate_items_with_commas"] ) ? $cpt_tax_type[0]["separate_items_with_commas"] : 'Separate ' .$cpt_label. ' with commas';
    			$cpt_labels['add_or_remove_items']          = ( $cpt_tax_type[0]["add_or_remove_items"] ) ? $cpt_tax_type[0]["add_or_remove_items"] : 'Add or remove ' .$cpt_label;
    			$cpt_labels['choose_from_most_used']        = ( $cpt_tax_type[0]["choose_from_most_used"] ) ? $cpt_tax_type[0]["choose_from_most_used"] : 'Choose from the most used ' .$cpt_label;
    
    			//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"]),
    				// SASCHA CORE HACK
    				//'rewrite' => array( 'slug' => $cpt_rewrite_slug, 'with_front' => $cpt_rewrite_withfront ),
    				'rewrite'	=> array(
    						'slug'     		=> $cpt_rewrite_slug,
    						'with_front'   	=> true,
    						'hierarchical'	=> $cpt_rewrite_hierarchical,
    					),
    				// END
    
    				//'rewrite' => array('slug' => $cpt_rewrite_slug),
    				'singular_label' => $cpt_singular_label,
    				'labels' => $cpt_labels,
    				'show_admin_column' => $cpt_tax_show_admin_column
    			) );

    https://www.ads-software.com/plugins/custom-post-type-ui/

Viewing 1 replies (of 1 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    If you could, go post it on our GitHub repo, but don’t hesitate to look through what’s there already to make sure we don’t have it. Provide more detail of what you’re doing as well if you could please.

    https://github.com/WebDevStudios/custom-post-type-ui/

    It may be a case of we just haven’t added/enabled it yet because of not much time spent on the plugin as a whole lately. Also my overhaul for 0.9 plays a part in that.

Viewing 1 replies (of 1 total)
  • The topic ‘rewrite hierarchical in taxonomies’ is closed to new replies.