Reply To: Separate query selections for multiple post types in one mashup

Home Forums MapPress Support Separate query selections for multiple post types in one mashup Reply To: Separate query selections for multiple post types in one mashup

#10981
Chris
Keymaster

    Hi Brad,

    There’s no example of building a mashup, since if you’re using PHP you can just create a map (you don’t need a query).

    There’s an example of creating two POIs and displaying them together on a map, so that’s what you’d need to extend:

    1) Read the unit post and create a POI for it

    2) Query the news posts and create POIs for each one

    3) Combine the two sets of POIs into one array and display the map

    Here’s an example of how to get all the POIs for an array of WordPress posts ($posts):

    $pois = array();   
    foreach($posts as $post) {        
      // Get the maps for each post    
      $maps = Mappress_Map::get_post_map_list($post->ID);
    
      // Add the pois for each map    
      foreach($maps as $map) {     
        foreach ($map->pois as $poi) {         
          $poi->postid = $post->ID;      
          $pois[] = $poi;     
        }    
      }   
    }