Map List Pro (from version 3.6.11) allows you to add additional categories and filters. Only the main categories can be used for limiting the locations added to the map.
Additional categories use the built in WordPress taxonomy system. To add an additional taxonomy you need to make sure it is registered against the maplist post type – this will make the additional categories show in the editor, and allow them to be used for filtering by the user. Use this code to add an additional “Food” taxonomy (add this to your theme’s functions.php file – always take a backup of this file just in case you run into any issues):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
// hook into the init action and call create_book_taxonomies when it fires add_action( 'init', 'create_food_taxonomy', 0 ); function create_food_taxonomy(){ $catargsFood = array( 'labels' => array( 'label' => __( 'Food type' ), 'rewrite' => array( 'slug' => 'food' ), 'hierarchical' => true, ), 'label' => "Food type", 'public' => true, 'show_in_nav_menus' => false, 'show_ui' => true, 'show_tagcloud' => false, 'hierarchical' => true, 'rewrite' => true, 'query_var' => true ); register_taxonomy( 'map_location_categories_food', array('maplist'), $catargsFood ); } |
Then you need to add usealltaxonomies=”true” to your shortcode to make them display in the front end.