Reply To: Tutorial – mappress pro with custom fields?

Home Forums MapPress Support Tutorial – mappress pro with custom fields? Reply To: Tutorial – mappress pro with custom fields?

#13483
Chris
Keymaster

    Hi,

    I think it would be easier to let the plugin do the work instead:

    1. Configure MapPress geocoding to allow it to automatically generate 1 map for each post, from the custom fields for address (or lat/lng). Save your posts to create the maps.

    2. Show a mashup of the maps.

    // Read $tchildren
    $post_ids = array();
    foreach($tchildren as $tchild) 
      $post_ids[] = $tchild->ID;
    
    $shortcode = '[mashup query="post__in=' . $post_ids . '"]';
    echo do_shortcode($shortcode);
    

    In the MapPress settings you can tell the mashup to show the address or poi contents, or you can modify the map_poi template to show other custom fields.

    Also – you have already have code to read the grandchildren ($tchildren), but if you can think of a way to do it with a normal WordPress query you could just use the shortcode. For example, perhaps you culd assign the parent and all children to the same tag or category, then query by that tag/category.