Plugin Directory

Changeset 1596693


Ignore:
Timestamp:
02/15/2017 04:47:11 PM (9 years ago)
Author:
ionutmorariu
Message:

CHG: load map if shortcode prio

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scale-lite-tools/trunk/inc/sl-google-maps/render-cpt.php

    r1596686 r1596693  
    2222  );
    2323}
    24 add_action('wp_enqueue_scripts', 'scale_lite_load_sl_maps_js', 10 );
    2524
    2625add_action( 'admin_menu', 'scale_lite_add_admin_menu' );
     
    7271
    7372}
    74 add_action('wp_enqueue_scripts', 'scale_lite_build_markers_array', 10 );
     73
    7574
    7675function register_markers_array() {
     
    8180
    8281}
    83 add_action('wp_enqueue_scripts', 'register_markers_array', 10 );
    8482
    8583
     
    173171
    174172}
    175 add_action('wp_enqueue_scripts', 'scale_lite_load_gmaps_v3', 50 );
    176173add_action('admin_enqueue_scripts', 'scale_lite_load_gmaps_v3', 50 );
    177174
     
    188185  return $good_protocol_url;
    189186}
     187
     188
     189
     190function scale_lite_load_maps_if_shortcode() {
     191  global $post;
     192  if(has_shortcode($post->post_content,'sl_gmaps')) {
     193    // execute code only if there is a sl_gmaps shortcode on the page
     194    add_action('wp_enqueue_scripts', 'scale_lite_build_markers_array', 9 );
     195    add_action('wp_enqueue_scripts', 'register_markers_array', 10 );
     196    add_action('wp_enqueue_scripts', 'scale_lite_load_gmaps_v3', 50 );
     197    add_action('wp_enqueue_scripts', 'scale_lite_load_sl_maps_js', 9 );
     198  }
     199}
     200add_action('wp_enqueue_scripts','scale_lite_load_maps_if_shortcode',0);
     201
     202
     203
     204
Note: See TracChangeset for help on using the changeset viewer.