Last active
January 26, 2023 14:06
-
-
Save JarrydLong/a0ae63f01d574c25eb2e264f4ba52841 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This recipe will override the default start location of a specific map. | |
* By default, we'll use the first marker on the map's location as the starting point | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
//Override the homepage-map and use the coordinates set out in mypmromm_override_default_map_start | |
function mypmpromm_override_first_marker( $override, $ID ){ | |
if( $ID == "homepage-map" ){ | |
$override = true; | |
} | |
return $override; | |
} | |
add_filter( 'pmpromm_override_first_marker', 'mypmpromm_override_first_marker', 10, 2 ); | |
//Using specific URLs | |
function mypmromm_override_default_map_start( $coordinates, $map_id ){ | |
$coordinates = array( | |
'lat' => -34.397, | |
'lng' => 150.644 | |
); | |
return $coordinates; | |
} | |
add_filter( 'pmpromm_default_map_start', 'mypmromm_override_default_map_start', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment