this_section] = array( 'name' => __('URI editor', 'permalink-manager') ); // Display separate section for each post type $post_types = Permalink_Manager_Helper_Functions::get_post_types_array('full'); foreach($post_types as $post_type_name => $post_type) { // Check if post type exists if(!post_type_exists($post_type_name)) { continue; } $icon = (class_exists('WooCommerce') && in_array($post_type_name, array('product'))) ? "" : ""; $admin_sections[$this->this_section]['subsections'][$post_type_name] = array( 'name' => "{$icon} {$post_type['label']}", 'function' => array('class' => 'Permalink_Manager_URI_Editor_Post', 'method' => 'display_admin_section') ); } // Permalink Manager Pro: Display separate section for each taxonomy $taxonomies = Permalink_Manager_Helper_Functions::get_taxonomies_array('full'); foreach($taxonomies as $taxonomy_name => $taxonomy) { // Check if taxonomy exists if(!taxonomy_exists($taxonomy_name)) { continue; } // Get the icon $icon = (class_exists('WooCommerce') && in_array($taxonomy_name, array('product_tag', 'product_cat'))) ? "" : ""; $admin_sections[$this->this_section]['subsections']["tax_{$taxonomy_name}"] = array( 'name' => "{$icon} {$taxonomy['label']}", 'html' => Permalink_Manager_Admin_Functions::pro_text(), 'pro' => true ); } // A little dirty hack to move wooCommerce product & taxonomies to the end of array if(class_exists('WooCommerce')) { foreach(array('product', 'tax_product_tag', 'tax_product_cat') as $section_name) { if(empty($admin_sections[$this->this_section]['subsections'][$section_name])) { continue; } $section = $admin_sections[$this->this_section]['subsections'][$section_name]; unset($admin_sections[$this->this_section]['subsections'][$section_name]); $admin_sections[$this->this_section]['subsections'][$section_name] = $section; } } return $admin_sections; } /** * Add scren options */ public function screen_options($html, $screen) { global $active_section; // Display the screen options only in "Permalink Editor" if($active_section != $this->this_section) { return $html; } $button = get_submit_button( __( 'Apply', 'permalink-manager' ), 'primary', 'screen-options-apply', false ); $html = "{$button}"; return $html; } }