WP Residence Help WP Residence Help

  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API
Home / Maps & Location Settings, Technical how to | Custom Code Required / Technical How To: Center map pin

Technical How To: Center map pin

4233 views 0

The information we add into infoboxes is “attached” tot the actual marker (pin) when we create it.

This happens in mapfunctions.js file via function createMarker()

To center pin in the map must remove map.panBy from all highlighted places as displayed in the below screenshot, but this will apply for all locations of the map/infobox.

center-pin-in-map-wpresidence

Explanations when you wish to center just the property page single pin.

When you click on a marker the infobox/picture appears. The map becomes centered on the marker position but since the picture is not opening, everything is a little off and not centered & visible. Because of that we “pan” the map so marker& image get centered and visible.

On the property page – after everything is loaded we simulate the click on the property marker. Because of that, you see the marker and image centered and visible.

If you don’t want to show the image for the property page we just have to remove the code that simulates the click. This code is on google_map_code_listings.js at line 108

Just remove the line form screenshot

Now, if you want to use minified version of the files you need to minify the google_map_code_listings.js file.  You can use this tool https://jscompress.com/ and the end results should be a file named google_map_code_listing.min.js

Maps & Location SettingsTechnical how to | Custom Code Required

Related Articles

  • Technical: Change the Schedule Tour Email Text and the Form Default Message
  • Property list filter customization
  • Technical – How to Change the Minimum Image Dimensions for Property Uploads in WPResidence
  • Introduction to WPResidence Header Customization

Help Categories

  • 18Agent, Agency & Developers
  • 5Blog Posts & Blog Lists
  • 38Elementor Shortcodes Built-In
  • 45FAQ
  • 15Footer
  • 5Getting Started
  • 37Header
  • 2IDX & MLSImport
  • 6Installation & Setup
  • 23Installation FAQ
  • 23Maps & Location Settings
  • 21Multi-Language Third Party Plugins
  • 6Other Third party Plugins
  • 19Pages
  • 4Payments & Monetization
  • 20Property Lists, Categories & Archive
  • 36Property Pages & Layouts
  • 31Search & Filtering
  • 162Technical how to | Custom Code Required
  • 8Technical: Actions and filters
  • 6Technical: Child Theme
  • 86Theme Options & Global Settings
  • 6Translations & Languages
  • 16WPBakery Shortcodes
  • 51WPResidence / WPEstate CRM
  • 50WPResidence 5.0 Documentation
  • 8WPResidence Elementor Studio
  • 50WPResidence Translate Plugin

Join Us On

Powered by WP Estate - All Rights Reserved
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API