zefyr

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Mashup query #13848
    zefyr
    Participant

    Hi,
    I have problem with call (in page template)
    <?php echo do_shortcode('[mashup width="100%" height="350" query="posts_per_page=-1&post_type=post]'); ?>
    It don´t show any POIs in the map.

    I use WP 3.6 and Twenty twelve theme.
    I have two different types of posts:
    1) BrandType1
    2) BrandType2

    I use in posts custom fields for address:
    map-adresa1 = Street and number
    map-adresa2 = Town
    map-adresa3 = State

    I have assigned in the administration custom field to the
    geocoding fields
    Map Custom Field
    Address Line 1 map-adresa1
    Address Line 2 map-adresa2
    Address Line 3 map-adresa3

    Where is the problem?

    in reply to: Tutorial – mappress pro with custom fields? #13488
    zefyr
    Participant

    I’ll try to rebuild with the categories.

    I have one more problem, I tried link with:

    
    <a href="#" onclick="mapp0.getPoiById('.$mapid.').open(true); return false;">Show in map</a>

    But it doesn´t work.
    How can I associate post ID to the POIs in map? When I used order of POI, it works.
    <a href="#" onclick="mapp0.getPoi(0).open(); return false;">

    in reply to: Tutorial – mappress pro with custom fields? #13482
    zefyr
    Participant

    I thought something like this:

    <?php 
    global $tpages;
    global $mapid;
    global $mpost;
    global $maptitle;
    global $mapadresa1;
    global $mapadresa2;
    global $mapadresa3;
    global $maplat;
    global $maplong;
    global $mymap;
    global $mypoi;
    
    $tpages = get_pages('child_of='.$post->ID.'&sort_column=menu_order&depth=1&parent='.$post->ID); 
    foreach($tpages as $tpage) {
      $tchildren = get_pages('child_of='.$tpage->ID.'&sort_column=menu_order&depth=1');
      foreach($tchildren as $tchild) {
        $mapid = $tchild->ID;
        $mpost = get_post($mapid); 
        $maptitle = $mpost->post_title;
        $mapadresa1 = get_post_meta($mapid, "map-adresa1", true);
        $mapadresa2 = get_post_meta($mapid, "map-adresa2", true);
        $mapadresa3 = get_post_meta($mapid, "map-adresa3", true);
        $maplat = get_post_meta($mapid, "map-lat", true);
        $maplong = get_post_meta($mapid, "map-long", true);
    
        if (!empty($maplat) && !empty($maplong)) {       
          $mypoi = new Mappress_Poi(array(
            "title" => $maptitle, 
            "body" => "$mapadresa1, $mapadresa2, $mapadresa3", 
            "point" => array(
              "lat" => $maplat, 
              "lng" => $maplong
               )
          ));
        }
        $pois[] = $mypoi;
      } 
    }
    $mymap = new Mappress_Map( array( "width" => "100%", "height" => 350 ) );
    $mypoi->geocode();
    $mymap->pois = $pois;
    echo $mymap->display();
    ?>
Viewing 3 posts - 1 through 3 (of 3 total)