### Trigger Installer Page POST Action Source: https://www.wpgmaps.com/help/docs/wpgmza_installer_page_on_post This PHP code snippet shows how to trigger the 'wpgmza_installer_page_on_post' action hook, which is used to handle additional storage data submitted via an Ajax POST request from the installer page. ```php do_action("wpgmza_installer_page_on_post"); ``` -------------------------------- ### Trigger wpgmza_installer_page_created Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_installer_page_created This hook is triggered when the installer page is created. It passes the installer page document object, allowing for modifications via DOMDocument or other actions. ```php do_action("wpgmza_installer_page_created", $document); ``` -------------------------------- ### Example Usage of wpgmza_admin_ui_render_{$pageSlugged}_after Source: https://www.wpgmaps.com/help/docs/wpgmza_admin_ui_render_pageslugged_after This PHP code demonstrates how to hook into the 'wpgmza_admin_ui_render_{$pageSlugged}_after' action. The specific page slug is dynamically inserted into the hook name. ```php do_action("wpgmza_admin_ui_render_{$pageSlugged}_after"); ``` -------------------------------- ### Example Usage of wpgmza_admin_ui_render_{$action}_before Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_admin_ui_render_action_before This hook allows you to render custom content before the admin page output is displayed. The specific action is dynamically determined. ```php do_action("wpgmza_admin_ui_render_{$action}_before"); ``` -------------------------------- ### Embedding a YouTube Video Source: https://www.wpgmaps.com/help/docs/embedding-iframes-in-your-markers This example shows how to embed a YouTube video using the 'iframe' plugin. Always use the YouTube embed URL with the https protocol. ```html [iframe width="560" height="315" src="https://www.youtube.com/embed/D1vYTAM_53k" title="Importing Markers in New York" frameborder="0" allowfullscreen] ``` -------------------------------- ### Basic Category Filter Shortcode Source: https://www.wpgmaps.com/help/docs/category-filter-shortcode This is a basic example of how to implement the category filter shortcode. Ensure you replace '1' with the actual ID of your map. ```html [wpgmza_category_filter id="1"] ``` -------------------------------- ### Basic iframe Shortcode Source: https://www.wpgmaps.com/help/docs/embedding-iframes-in-your-markers Use this shortcode format to embed an iframe into your marker description. Ensure the 'iframe' plugin is installed and active. ```html [iframe src="url" title="description"] ``` -------------------------------- ### Execute Upgrade Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_base_upgrade_hook This hook is triggered when the plugin versions change, indicating an update has been installed. Use it to automate tasks like table creation or data migration. ```php do_action("wpgmza_base_upgrade_hook"); ``` -------------------------------- ### Execute First Run Logic with wpgmza_plugin_core_on_first_run Source: https://www.wpgmaps.com/help/docs/wpgmza_plugin_core_on_first_run Use this action hook to add custom logic that should run once when the plugin is first activated. It executes before any activation-related redirects. ```php do_action("wpgmza_plugin_core_on_first_run"); ``` -------------------------------- ### Execute wpgmza_plugin_core_on_init Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_plugin_core_on_init This PHP code snippet shows how to execute the wpgmza_plugin_core_on_init action hook. This hook is designed to run as the final step in the plugin's initialization process. ```php do_action("wpgmza_plugin_core_on_init"); ``` -------------------------------- ### Apply Filter to Default Settings Source: https://www.wpgmaps.com/help/docs/wpgmza_plugin_get_default_settings Use this filter to modify the default settings array before it is applied during the plugin's installation. Ensure your modifications are returned within the array. ```PHP apply_filters( 'wpgmza_plugin_get_default_settings', $settings ); ``` -------------------------------- ### Using wpgmza_admin_ui_render_content_before Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_admin_ui_render_content_before-2 This hook is used to inject content before the admin page output. It applies to all main menu items, with some exceptions for legacy items. ```php do_action("wpgmza_admin_ui_render_content_before"); ``` -------------------------------- ### Using wpgmza_shortcode_before_output Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_shortcode_before_output This hook is used to add custom output before a shortcode is rendered. It accepts the shortcode slug as an argument. ```php do_action( 'wpgmza_shortcode_before_output', $slug ); ``` -------------------------------- ### Apply wpgmza-get-library-dependencies Filter Source: https://www.wpgmaps.com/help/docs/wpgmza-get-library-dependencies This PHP code demonstrates how to apply the 'wpgmza-get-library-dependencies' filter to modify script dependencies. Ensure you return the modified array. ```php apply_filters( 'wpgmza-get-library-dependencies', $libraryDependencies ); ``` -------------------------------- ### Initialize REST API Steps Source: https://www.wpgmaps.com/help/docs/wpgmza_rest_api_init Use this hook to execute custom code after the WP Go Maps REST API has been initialized. This is useful for adding custom endpoints or modifying existing ones. ```php do_action("wpgmza_rest_api_init"); ``` -------------------------------- ### Extend Panel Info Window Populate Method Source: https://www.wpgmaps.com/help/docs/updating-panel-info-window-dynamically This JavaScript snippet extends the `populatePanel` method of the `WPGMZA.ProInfoWindow` prototype. It allows you to add custom logic after the original panel population, such as manipulating the DOM elements of the info window. Use this to modify the appearance or content of the panel info window dynamically. ```javascript jQuery(function($){ /* Clone the original method */ WPGMZA.ProInfoWindow.prototype._populatePanel = WPGMZA.ProInfoWindow.prototype.populatePanel; WPGMZA.ProInfoWindow.prototype.populatePanel = function(){ /* Call the original method */ this._populatePanel(); /* Grab a self refernce, to be used in our loop */ const self = this; $('.wpgmza-panel-info-window[data-map="' + this.feature.map.id + '"]').each(function(){ /* Loop through each map and it's respective panel listing */ /* For the sake of example, we will just hide the address, but really this could be any logic you might want */ $(this).find('.wpgmza-address').hide(); }); } }); ``` -------------------------------- ### Execute Legacy Backwards Compatibility Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_check_map_editor_backwards_compat This hook is intended for rendering content after admin page output for legacy compatibility. It is not recommended for use in new production code. ```php do_action("wpgmza_check_map_editor_backwards_compat"); ``` -------------------------------- ### Using wpgmza_create_{$class} Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_create_class This hook allows for extension or replacement of native classes within the WP Go Maps core. It is an advanced feature recommended for experienced developers. The {$class} placeholder represents the specific class name being initialized. ```php apply_filters("wpgmza_create_{$class}", $args); ``` -------------------------------- ### Enqueue CodeMirror Scripts with Action Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_script_loader_enqueue_codemirror Use the 'wpgmza_script_loader_enqueue_codemirror' action hook in PHP to load custom CodeMirror styles, scripts, or execute additional logic when the CodeMirror editor is initialized. ```php do_action("wpgmza_script_loader_enqueue_codemirror"); ``` -------------------------------- ### Add Action to Plugin Activation Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_plugin_core_on_activate This snippet shows how to hook into the wpgmza_plugin_core_on_activate action to run custom code during plugin activation. ```php do_action("wpgmza_plugin_core_on_activate"); ``` -------------------------------- ### Trigger wpgmza_styling_page_created Action Source: https://www.wpgmaps.com/help/docs/wpgmza_styling_page_created This hook is relevant for Atlas Novus builds and allows for direct manipulation of the component styling page using DOMDocument. ```php do_action("wpgmza_styling_page_created", $document); ``` -------------------------------- ### Apply wpgmza_shortcode_map_container_before Filter Source: https://www.wpgmaps.com/help/docs/wpgmza_shortcode_map_container_before This PHP code demonstrates how to apply the wpgmza_shortcode_map_container_before filter. It takes the default HTML output as an argument and expects the modified HTML to be returned. This filter only runs when using the Atlas Novus internal engine. ```php apply_filters("wpgmza_shortcode_map_container_before", $html); ``` -------------------------------- ### Using the wpgmza_admin_ui_render_{$pageSlugged}_before Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_admin_ui_render_pageslugged_before This hook allows you to render custom content before the admin page output. The specific hook name is dynamically generated based on the page slug. ```php do_action("wpgmza_admin_ui_render_{$pageSlugged}_before"); ``` -------------------------------- ### Trigger wpgmza_plugin_core_update_all_xml_files Action Source: https://www.wpgmaps.com/help/docs/wpgmza_plugin_core_update_all_xml_files Use this action hook to add custom logic that should run after all XML files in the plugin are updated. This is useful for tasks like cache invalidation or re-indexing. ```php do_action("wpgmza_plugin_core_update_all_xml_files"); ``` -------------------------------- ### Execute wpgmza_admin_ui_render_content_after Hook Source: https://www.wpgmaps.com/help/docs/wpgmza_admin_ui_render_content_after-2 Use this action hook to execute custom code after the main admin page content has been rendered. This is applicable to most main menu items, with exceptions for legacy items. ```php do_action("wpgmza_admin_ui_render_content_after"); ``` -------------------------------- ### Reinitialize Maps with Timeout on Click Source: https://www.wpgmaps.com/help/docs/my-map-is-not-showing-on-my-website If the previous method doesn't work, try this approach which reinitializes maps with a 500ms delay after a click. Adjust the timeout value as needed for your site. ```javascript jQuery(‘.the_class_name_of_your_tab_or_accordion’).click(function(){ setTimeout(function(){ for(var entry in wpgmaps_localize){ InitMap(wpgmaps_localize[entry][‘id’],’all’,false); } },500); }); ``` -------------------------------- ### Manipulate Map Center, Zoom, and Markers with JavaScript Source: https://www.wpgmaps.com/help/docs/map-manipulation This snippet demonstrates how to access a map by its ID, retrieve a specific marker, and then use its position to set the map's center and zoom level. It requires the WPGMZA global object to be available. ```javascript jQuery(function($){ // Do not run if WPGMZA global is not available if(!WPGMZA){ return; } // Get a reference to your map var activeMap = WPGMZA.getMapByID('1'); // Get a specific marker by it's ID var targetMarker = activeMap.getMarkerByID('10'); // Get target markers position as a WPGMZA.LatLng object var targetPosition = targetMarker.getPosition(); /* * Alternatively, you could set your own lat lng as seen in the line below * * This uses the WPGMZA.LatLng constructor, which supports a lat/lng combo */ // targetPosition = new WPGMZA.LatLng(37.09, -95.7); // Pan the map to the target position activeMap.setCenter(targetPosition); // Set map soom level (0 to 21 are valid levels of zoom) activeMap.setZoom(18); }); ``` -------------------------------- ### Enqueue Additional Styles with wpgmza_script_loader_enqueue_styles Source: https://www.wpgmaps.com/help/docs/wpgmza_script_loader_enqueue_styles Use this action hook to load additional CSS or JavaScript files into the WordPress environment. This can be applied to the frontend, admin area, or both, depending on your specific requirements. ```PHP do_action("wpgmza_script_loader_enqueue_styles"); ``` -------------------------------- ### Trigger wpgooglemaps_hook_user_js_after_core Hook Source: https://www.wpgmaps.com/help/docs/wpgooglemaps_hook_user_js_after_core Use this PHP action to enqueue additional JavaScript after core modules have been loaded. This allows for localization of variables and addition of custom scripts. ```php do_action("wpgooglemaps_hook_user_js_after_core"); ``` -------------------------------- ### Create a Map Mashup with Shortcode Source: https://www.wpgmaps.com/help/docs/shortcodes Combine multiple maps into a single view using the mashup shortcode. Ensure the 'id' and 'parent_id' match the main map you want to draw settings from. Specify the IDs of maps to include in the 'mashup_ids' parameter. ```shortcode [wpgmza id="2" mashup=true mashup_ids="2,3" parent_id="2"] ``` -------------------------------- ### Basic Infowindow Shortcode Usage Source: https://www.wpgmaps.com/help/docs/infowindow-shortcode Use this shortcode to display the infowindow for a specific marker ID as a fixed element on your page. Ensure a map is present on the same page. ```shortcode [wpgmza_infowindow id="1"] ``` -------------------------------- ### Enqueue Scripts with wpgmza_script_loader_enqueue_scripts Source: https://www.wpgmaps.com/help/docs/wpgmza_script_loader_enqueue_scripts Use this action hook to load custom scripts into the WP Go Maps environment. This can be applied to the frontend, admin area, or both. ```php do_action("wpgmza_script_loader_enqueue_scripts"); ``` -------------------------------- ### Override InfoWindow Link Behavior Source: https://www.wpgmaps.com/help/docs/shortcodes Use the `new_window_link` parameter to control whether InfoWindow links open in a new tab or window. Set to 'yes' to enable, 'no' to disable. ```shortcode [wpgzma id="1" new_window_link="yes"] ``` -------------------------------- ### Apply Filter to Build Version Source: https://www.wpgmaps.com/help/docs/wpgmza_internal_engine_build_version Use this PHP filter to modify the build version string before it is output. The filter accepts the current build string as an argument and expects a modified string to be returned. ```php apply_filters("wpgmza_internal_engine_build_version", $build); ``` -------------------------------- ### Basic Map Shortcode Usage Source: https://www.wpgmaps.com/help/docs/map-shortcode Use this shortcode to display your created map anywhere on your site. All enabled features for a map are automatically included. ```shortcode [wpgmza id="1"] ``` -------------------------------- ### Basic Marker Listing Shortcode Source: https://www.wpgmaps.com/help/docs/marker-listing-shortcode Use this shortcode to display a list of all markers for a given map ID. Ensure the map ID is correct. ```shortcode [wpgmza_marker_listing id="1"] ``` -------------------------------- ### Hook into Global Settings Page Creation Source: https://www.wpgmaps.com/help/docs/wpgmza_global_settings_page_created Use this hook to directly alter the content of the global settings page using DOMDocument or to perform custom actions when the page is initialized. The hook provides the settings page instance as an argument. ```php do_action("wpgmza_global_settings_page_created", $document); ``` -------------------------------- ### Basic Directions Shortcode Usage Source: https://www.wpgmaps.com/help/docs/directions-shortcode Use this shortcode to place a directions widget on your page. Ensure a map is present on the same page for the shortcode to function correctly. ```shortcode [wpgmza_directions id="1"] ``` -------------------------------- ### Triggering wpgmza_plugin_load_scripts Action Source: https://www.wpgmaps.com/help/docs/wpgmza_plugin_load_scripts This PHP code snippet shows how to trigger the wpgmza_plugin_load_scripts action hook. Use this hook to load custom scripts or perform actions after the main plugin scripts have been loaded. ```php do_action("wpgmza_plugin_load_scripts"); ``` -------------------------------- ### Apply wpgmza_shortcode_map_components Filter Source: https://www.wpgmaps.com/help/docs/wpgmza_shortcode_map_components Use this filter to modify the components loaded with a map when using the shortcode. This filter is only active when the Atlas Novus internal engine is in use. ```php apply_filters("wpgmza_shortcode_map_components", $components, $map, $attributes); ``` -------------------------------- ### Override Store Locator Template Source: https://www.wpgmaps.com/help/docs/template-overrides This PHP snippet demonstrates how to override the 'store-locator.html.php' template by providing a custom path to a local plugin file. Ensure the custom template file exists before returning its path. ```php /dev/null 2>&1 ```