• Resolved andy3000

    (@andy3000)


    I have added the following to functions.php
    I am trying to place the map on the front page of a blog where Reading Settings is set to front page shows latest posts
    I get the following error:
    Parse error: syntax error, unexpected T_VARIABLE in /home/content/40/9512840/html/wp-content/themes/wp-creativix/functions.php on line 16
    Wasn’t sure if return_true should be proceeded with one _ or two but either way i get the error.

    function bgmpShortcodeCalled()
    {
    	global $post;
    
    	$shortcodePageSlugs = array(
    		'home'
    	);
    
    	if( $post )
    		if( in_array( $post->post_name, $shortcodePageSlugs ) )
    			add_filter( 'bgmp_map-shortcode-called', '__return_true' );
    }
    add_action( 'wp', 'bgmpShortcodeCalled' );

    http://wordpress.org/extend/plugins/basic-google-maps-placemarks/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ian Dunn

    (@iandunn)

    Did you recently upgrade to version 1.8? I accidentally overwrote the tags/1.8 directory with trunk about 30 minutes ago, but it’s fixed now. If you reinstall 1.8 that will fix it.

    If not, could you copy the entire functions.php file to pastebin.com and post a link here?

    Thread Starter andy3000

    (@andy3000)

    I had not upgraded but I did and I corrected an error in the php file but now I’m getting

    Basic Google Maps Placemarks error: JavaScript and/or CSS files aren’t loaded. If you’re using do_shortcode() you need to add a filter to your theme first. See the FAQ for details.

    even though I added the filter code above.

    Thread Starter andy3000

    (@andy3000)

    Here is the functions file in pastebin. Note that error has changed to the one in the post directly above this. (Its telling me I need to ad the filter)

    Plugin Author Ian Dunn

    (@iandunn)

    I think the home page might be a special case; I’m not sure the page slug works for a page that’s assigned as the home page. Try adding code inside the bgmpShortcodeCalled() function, at the bottom.

    if( is_front_page() || is_home() )
    		add_filter( 'bgmp_map-shortcode-called', '__return_true' );
    Thread Starter andy3000

    (@andy3000)

    That code works. As an obvious place to use the map plugin is probably on the front page that shows latest posts you might want to add that code to the installation directions. Thanks!

    Plugin Author Ian Dunn

    (@iandunn)

    Good point, I’ll update that in the next release.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘[Plugin: Basic Google Maps Placemarks] error when adding do shortcode to function.php’ is closed to new replies.