Guest User

example

a guest
Jul 19th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. function pec_bgmp_shortcode_check()
  2. {
  3.     global $post;
  4.    
  5.     $shortcodePageSlugs = array(
  6.         'home',
  7.     );
  8.    
  9.     if( $post )
  10.         if( in_array( $post->post_name, $shortcodePageSlugs ) )
  11.             add_filter( 'bgmp_map-shortcode-called', 'setBGMPMapShortcodeArguments' );
  12. }
  13. add_action( 'wp', 'pec_bgmp_shortcode_check' );
  14.  
  15. function setBGMPMapShortcodeArguments( $options )
  16. {
  17.     global $bgmp;
  18.     $coordinates = $bgmp->geocode( 'Seattle' );
  19.    
  20.     $options[ 'mapWidth' ] = '500';
  21.     $options[ 'mapHeight' ] = '400';
  22.     $options[ 'latitude' ] = $coordinates[ 'latitude' ];
  23.     $options[ 'longitude' ] = $coordinates[ 'longitude' ];
  24.     $options[ 'zoom' ] = '10';
  25.     $options[ 'type' ] = 'ROADMAP';
  26.     $options[ 'typeControl' ] = 'HORIZONTAL_BAR';
  27.     $options[ 'navigationControl' ] = 'SMALL';
  28.     $options[ 'infoWindowMaxWidth' ] = '350';
  29.    
  30.     return $options;
  31. }
  32. add_filter( 'bgmp_map-shortcode-called', 'setBGMPMapShortcodeArguments' );
Advertisement
Add Comment
Please, Sign In to add comment