• Resolved dcfunkster

    (@dcfunkster)


    I’m attempting to edit the theme files within the confines of a child theme on my website. I want to add a Google Map embed on every card-single.php page that retrieves the address value from the entry, and inputs into a Google Maps iframe, but the documentation for retrieving these values isn’t great on the Connections website.

    How do I retrieve fields from the entry? Is there a custom $entry->getAddress() function I should be using for this? $entry->getAddressBlock() doesn’t work for me as it adds a bunch of extra HTML that I don’t need.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Steven

    (@shazahm1hotmailcom)

    The method is $entry->getAddresses(). Here’s the link to the doc, in the code.

    As you are interested in a Map, you should look at this method too:

    I hope this helps; please let me know.

    Thread Starter dcfunkster

    (@dcfunkster)

    This helps immensely, thank you! Just what I was looking for.

    I tried the built-in map functionality, and it’s not quite what I’m looking for. I don’t like the design of the included map, and it looks like I’d have to press the “Geolocation” button on every single entry, which there are hundreds of already and that would be a big hassle.

    Plugin Author Steven

    (@shazahm1hotmailcom)

    RE: I don’t like the design of the included map

    It will be either the Google Map tiles, if you enable the Google Maps API key, or the OSM Map tiles.

    RE: it looks like I’d have to press the “Geolocation” button on every single entry

    The latitude and longitude are required to display the map pins. Geolocation is done automatically when adding a new entry or adding an address to an entry. If you are missing this info, it is because the address could not be geolocated. The free OSM service can be hit or miss, especially outside of the US. I recommend using Google Maps, as that is far more reliable.

    You could geolocate using JS, but that would have to be done on each page load, so it would be far slower than attaching the lat and lng to each address.

    I hope this helps; please let me know.

    Thread Starter dcfunkster

    (@dcfunkster)

    Ohh, I was probably using the free OSM map tiles then, that makes sense.

    I still would have to press the “Geolocate” button every entry in this instance, as all of my entries are already imported (200+), with addresses already added. It was easier just to add the Google Maps JS API to the site and calculate the geolocation per entry.

    Thanks for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get PHP values from $entry variable’ is closed to new replies.