Support » Plugin: Map My Posts » Use with custom taxonomy?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Did you find a solution to this?

    in case the creator of this plugin sees this:
    I tried to add my custom taxonomy in MapMyPosts.php (line 309/349) and admin-settings.php (line 61), but now it throws up a blank page.

    Ok I fixed it. I had to change three files. My custom taxonomy is called film_country, replace this with whatever you have!
    You need to make note of where you made the changes in case of a plugin update. The additional form fields only show up on the edit screen.

    map-my-posts/inc/MapMyPosts.php:
    function get_cache_list
    add (after the first if, before else):

    else if ( $taxonomy == 'film_country' ) {
    			$key .= '_film_country';
    		} 

    function get_term_list
    remove:

    if ( $taxonomy != 'category' ) {
    			$taxonomy = 'post_tag';
    		}

    map-my-posts/inc/MapMyPostsAdmin.php:
    function enqueue_admin_scripts()
    edit like this to add region support for your taxonomy. Sadly the map won’t show, but it lets you search the region/city by name and add it accordingly:
    if ( $screen->id == 'edit-category' || $screen->id == 'edit-post_tag' || $screen->id == 'edit-film_country' )

    function build_cache_list

    add:

    //repeat same process for the film countries
    		$country_list = array();
    		$marker_list = array();
    		$terms = get_terms( 'film_country', 'hide_empty=0' );
    		foreach ( $terms as $obj ) {
    			$data = $this->get_cache_term( $obj->term_id, $obj->taxonomy );
    			if ( $data['country'] ) {
    				// should we assign to parent category country if that exists?
    				$country_list[$obj->term_id] = $data['country'];
    			}
    			if ( is_numeric( $data['lat'] ) && is_numeric( $data['lng'] ) ) {
    				$marker_list[$obj->term_id] = $data['lat'] . ',' . $data['lng'];
    			}
    		}
    		update_option( MAPMYPOSTS_OPTION_PREFIX . '_film_country_country_list', $country_list );
    		update_option( MAPMYPOSTS_OPTION_PREFIX . '_film_country_marker_list', $marker_list );

    map-my-posts/view/admin-settings.php:
    around line 60 add:
    <option value="film_country" <?php selected('film_country', $settings['taxonomy']); ?>><?php _e('Film Country', 'map-my-posts'); ?></option>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use with custom taxonomy?’ is closed to new replies.