[Plugin: Basic Google Maps Placemarks] Using [bgmp-map] in a template file with do_shortcode():
-
I want to implement a map to a contact page.
I am not a very skilled PHP developer. I can not get solution under to work. Do you have an example on this code? My theme name is A-theme, and I am not alode to write that name with the – in the function.Any suggestions to get any futher will be appreciated!!
The text under is from the plugin site: http://ww.wp.xz.cn/extend/plugins/basic-google-maps-placemarks/installation/
For efficiency, the plugin only loads the required JavaScript, CSS and markup files on pages where it detects the map shortcode is being called. It’s not possible to detect when do_shortcode() is used, so you need to manually let the plugin know to load the files by adding this code to your theme:function my_theme_name_bgmp_shortcode_check()
{
global $post;$shortcodePageSlugs = array(
‘first-page-slug’,
‘second-page-slug’,
‘hello-world’
);if( $post )
if( in_array( $post->post_name, $shortcodePageSlugs ) )
add_filter( ‘bgmp_map-shortcode-called’, ‘__return_true’ );
}
add_action( ‘wp’, ‘my_theme_name_bgmp_shortcode_check’ );
Copy and paste that into your theme’s functions.php file or a functionality plugin, update the function names and filter arguments, and then add the slugs of any pages/posts containing the map to $shortcodePageSlugs. If you’re using it on the home page, the slug will be ‘home’.This only works if the file that calls do_shortcode() is registered as a page template and assigned to a page.
http://ww.wp.xz.cn/extend/plugins/basic-google-maps-placemarks/
The topic ‘[Plugin: Basic Google Maps Placemarks] Using [bgmp-map] in a template file with do_shortcode():’ is closed to new replies.