• Resolved super powered

    (@super-powered)


    Hi, Im having an issue getting the nearby_list to display only a certain post type.

    In one area of my site, I need to display just the post type ‘store’ and in another just the post type ‘congregation.’

    The map is working as expected.
    <?php echo GeoMashup::map($args);?>

    but the nearby list (which takes the same arguments) is not, it’s pulling up ALL post types in both places:
    <?php echo GeoMashup::nearby_list($args); ?>

    <?php
    $query_args = array
            (
                'post_type'      => 'store',
            );
    $the_query = new WP_Query($query_args);
     $args = array
            (
                'map_content' => $the_query,
                'near_lat' => $lat,
                'near_lng' => $long,
                'radius_mi' => 120,
                'radius' => 120,
                'units' => 'mi',
                'center_lat' => 0,
                'center_lng' => 0,
                'marker_select_info_window' => true,
                //'load_empty_map' => false,
                'auto_info_open' => false,
                'add_google_bar' => true,
                'add_map_control' => true,
                'add_map_type_control' => 'G_NORMAL_MAP, G_SATELLITE_MAP, G_SATELLITE_3D_MAP, G_HYBRID_MAP, G_PHYSICAL_MAP',
                'map_control' => 'GLargeMapControl3D',
                'height' => '100%',
                'width' => '100%',
                'zoom' => 'auto',
                'auto_zoom_max' => 10,
                'enable_scroll_wheel_zoom' => true,
            )?>

    Is there a way to make the nearby_list work with the ‘map_content’ property, or something similar?

    Worth mentioning: I’m using the ACF integration from the How To on the wiki:
    https://support.advancedcustomfields.com/forums/topic/acf-and-geo-mashup-integration/

    https://www.ads-software.com/plugins/geo-mashup/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter super powered

    (@super-powered)

    Update:
    I’ve added some code to geo-mashup.php in the nearby_list() function:

    unset( $args['template'] );
    		 $map_content = ( isset( $args['map_content'] ) ) ? $args['map_content'] : null;
    		 if ( $map_content instanceof WP_Query )
    		 {
    			 echo 'Im Working!'; //debug
    			 // We've been given a post query, put its contents in a global map
    			 $args['object_ids'] = implode( ',', wp_list_pluck( $map_content->posts, 'ID' ) );
    			 echo $args['object_ids']; //more debug
    		 }

    Now checking to see how (or if) object_ids is handled in geo-mashup-search.php.
    EDIT: Looks like object_ids is included in the file but not used. hrrrrmmmm…

    Where is ‘geo_mashup_search_query_args’ located? I’m assuming its a function that’s filtering.

    Thread Starter super powered

    (@super-powered)

    I DID IT!
    Turns out I didn’t need to find the filter.

    Just added ‘object_ids’ to the $geo_query_args in the query() function in geo-mashup-search.php.

    $geo_query_args = wp_array_slice_assoc(
    			$this->query_vars,
    			array( 'object_name', 'sort', 'exclude_object_ids', 'limit','object_ids' )
    		);
    Plugin Author Dylan Kuhn

    (@cyberhobo)

    The nearby list should also accept the map_post_type parameter documented here:

    https://github.com/cyberhobo/wordpress-geo-mashup/wiki/Tag-Reference#map

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Nearby List Post Type Query’ is closed to new replies.