Chris

Forum Replies Created

Viewing 15 posts - 526 through 540 (of 1,120 total)
  • Author
    Posts
  • in reply to: Append the data that is shown within the InfoWindow via Ajax #14210
    Chris
    Keymaster

      Hi,

      I don’t really know how to do that – it’s not something the plugin is set up to do – so I can only give you some ideas / suggestions:

      First, if possible, it would be much easier to just populate #bottom when you create the POI rather than using AJAX.

      If you do need AJAX, you might try catching the ‘domready’ event that occurs when an infoWindow is opened. The MapPress map ojbect has a name. By default the maps on a page are named ‘mapp0’, ‘mapp1’, etc. You can use ‘name=”myname”‘ in the shortcode to specify a name.

      With the map object, you can get the infowindow by calling getInfoWindow:
      mapp0.getInfoWindow()

      Then you can use the google event ‘domready’ to know when the window is opened. When that event occurs, you can make the AJAX call and replace the infoWindow contents. Below is some pseudo-code to illustrate the idea:

      var iw = mapp0.getInfoWindow();
      google.maps.event.addListenerOnce(iw, "domready", function() {
        .. your AJAX code here ..
        iw.setContent(newContent);
      });
      

      There is no event before the infoWindow is opened, so the infoWindow will show without the content and then resize with the new content after the AJAX call.

      in reply to: Shortcode in bubble #14209
      Chris
      Keymaster

        Hi,

        It’s actually the same template file for both single maps and mashups.

        How you do this depends on how the shortcode was programmed, where the shortcode is, and what you’re displaying in the mashup (based on the “mashup body” setting in the MapPress settings or the mashup shortcode).

        If you’re displaying the poi body in the mashup, and the shortcode is in the poi body, then the technique above should work.

        If you’re displaying post excerpts in the mashup, then MapPress will set up the poi body using WP function get_the_excerpt(). Unfortunately, the WP standard excerpt function strips out all shortcodes. This may be what is happening in your case.

        There are various workarounds for that problem. Try a quick search on ‘the_excerpt’ and ‘shortcodes’ in Google or the WordPress codex. Here are few examples that might help:

        http://andrewferguson.net/2012/07/22/using-shortcodes-in-the_excerpt/
        http://wordpress.stackexchange.com/questions/75631/the-excerpt-or-get-the-excerpt-with-shortcode-escape

        Chris
        Keymaster

          It’ll make more sense if you start a new thread, or you can email me directly if you like.

          Chris
          Keymaster

            Hi,

            OK – then in the loop, I think you just need to set the address:

            new Mappress_Poi(array("corrected_address" => "200 Main Street", “iconid” => $search_term, “title” => $title, “body” => $body, “point” => array(“lat” => $list_locations['latitude'], “lng” => $list_locations['longitude'])));

            Chris
            Keymaster

              Hi,

              I’m assuming you’re creating the POI by entering an address, then dragging the marker.

              If so, this is fixed in version 2.40.8. Previous versions would ‘forget’ the address when a POI was dragged.

              With the new version, the plugin should remember the original address for directions, even if the marker is dragged to a new location.

              in reply to: Categories of a CustomPostType-Entry #14183
              Chris
              Keymaster

                Hi, maybe one of the other terms functions would work for you? I think they usually return an object, not just the term name:

                http://codex.wordpress.org/Function_Reference/get_terms

                in reply to: MapPress database tables are missing #14182
                Chris
                Keymaster

                  Hi,

                  You’re getting ID8 because when you uninstall the database tables are not deleted, so that’s normal.

                  For the error: I did see this on one site where the database prefix was mixed case, i.e. “WordPress1234_wp”.

                  If you’d like to send a login I’ll trace it for you.

                  in reply to: Mashup => POI with output of custom fields… #14177
                  Chris
                  Keymaster

                    Hi Connie,

                    There’s a simple example here for displaying custom fields using get_post_meta():
                    http://mappresspro.com/mappress-documentation#toc-modifying-the-poi-template

                    I can’t tell you how to read the Types fields because I’m not familiar with their API. You’ll need to consult their documentation.

                    They probably have information about how to get custom fields in a template file. The POI template should work the same way.

                    in reply to: more custom fileds in Geocoding body field #14162
                    Chris
                    Keymaster

                      Hi,

                      I’m sorry, but I don’t know why the ACF call wouldn’t work. The POI layout runs within that same template, so it should behave identically to a call from the template.

                      Does it work if you use a regular (non-ACF) custom field? Perhaps you can have ACF save the value to a custom field you can read with get_post_meta() instead.

                      Also, could you post your entire template file or email it to me?

                      in reply to: more custom fileds in Geocoding body field #14157
                      Chris
                      Keymaster

                        Hi,

                        If you use a regular (non-ACF) field with the code I gave you, does it work?

                        That code works for me on my test system, so I think the problem is with getting the ACF field value using get_field().

                        Try to test this without MapPress. Add your code with get_field() into the template file for single posts (usually in the theme directory ‘single.php’). Do you see a value that way?

                        If not, then you’ll need to ask the ACF folks why the value isn’t coming through.

                        in reply to: Automatic Map Creation by Address (Post Title) #14143
                        Chris
                        Keymaster

                          Hi,

                          The [mappress] shortcode doesn’t have anything to do with auto-generation of the maps. But they don’t get generated until a post is saved or published, so maybe it’s a timing issue?

                          Try this: go to a post where you have an ‘address’ custom field and publish it – you should see the map generated, without needing to put the shortcode in the post.

                          The shortcode doesn’t take an ‘address’ attribute because you would then need to geocode that address every time a page is displayed. It would slow down your site and you could hit the Google usage limits (see the docs for details).

                          in reply to: Automatic Map Creation by Address (Post Title) #14141
                          Chris
                          Keymaster

                            Hi,

                            The maps are only generated from custom fields. The plugin doesn’t read the post title.

                            If you can copy the post title to a custom field when the post is saved, that might work. Then the map could be generated from that field. For example, copy the post title to a field called ‘address’.

                            That would require a little PHP. I think you could use this event:

                            http://codex.wordpress.org/Plugin_API/Action_Reference/save_post

                            in reply to: Delete Portion of a line #14115
                            Chris
                            Keymaster

                              Hi,

                              The plugin enables Google’s ‘drawing manager’, which takes care of the line/shape editing. It’s not at all intuitive, but I think it’s possible to do what you want:

                              To delete a vertex: drag an existing vertex over another one and the first vertex is deleted

                              To insert a vertex: drag any of the existing vertices. This will create two new vertices each time you drag.


                              As a side-note: if you’re going to be drawing complex shapes, it might be easier to do it in Google Maps or Google Earth and then embed them in the MapPress map as a KML file. Google’s own applications have better line/shape editing tools that are not available in the maps API.

                              in reply to: InfoBox dimensions #14112
                              Chris
                              Keymaster

                                The default is the Google ‘infowindow’. The main styling classes are:
                                mapp-iw
                                mapp-title
                                mapp-body

                                Note that styling for the infowindow is limited, since a lot of it is set by Google (for example the shape, the shadow, etc.). If you use Firebug or IE Developer Tools, you can see the Google classes, they’re injected into the document header when the page is loaded.

                                in reply to: InfoBox dimensions #14109
                                Chris
                                Keymaster

                                  Hi,

                                  The CSS is the file ‘mappress.css’. Look at:
                                  mapp-ib
                                  mapp-title
                                  mapp-body

                                Viewing 15 posts - 526 through 540 (of 1,120 total)