Setting up multiple category filtering

As of version 3.6.11 Map List Pro allows you to add additional category filters to the front end. Currently only the main categories can be used for backend filtering though.

Adding additional categories is very simple as it uses the built in WordPress taxonomy system. All you need to do is add an additional taxonomy and make sure it is registered against the maplist post type – this will make the additional categories show in the editor.

Then you need to add usealltaxonomies=”true” to your shortcode to make them display in the front end.

Below is an example of an additional “Food” category being added to the map. This code should be pasted into the functions.php file of your active theme (always take a backup of this file just in case you run into any issues).

// 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 );
}