Plugin Directory

Changeset 1595187


Ignore:
Timestamp:
02/13/2017 07:27:19 PM (9 years ago)
Author:
ionutmorariu
Message:

only run files if map present

File:
1 edited

Legend:

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

    r1591181 r1595187  
    55* @since 0.1
    66*/
     7
    78
    89function scale_lite_admin_google_maps() {
     
    2223  );
    2324}
    24 add_action('wp_enqueue_scripts', 'scale_lite_load_sl_maps_js', 10 );
    2525
    2626add_action( 'admin_menu', 'scale_lite_add_admin_menu' );
     
    3636  );
    3737}
    38 
    3938
    4039// store all the maps data
     
    7271
    7372}
    74 add_action('wp_enqueue_scripts', 'scale_lite_build_markers_array', 10 );
    7573
    7674function register_markers_array() {
     
    8179
    8280}
    83 add_action('wp_enqueue_scripts', 'register_markers_array', 10 );
    84 
    8581
    8682// store all the maps data
     
    170166    true
    171167  );
    172   wp_enqueue_style( 'scale_lite_google_maps_css',  $scale_lite_url_path . 'assets/css/fronted.google-maps.css', array(),'1.0.5', 'all' );
    173 
     168  wp_enqueue_style( 'scale_lite_google_maps_css',
     169    $scale_lite_url_path . 'assets/css/fronted.google-maps.css',
     170    array(),
     171    '1.0.5',
     172    'all' );
    174173}
    175 add_action('wp_enqueue_scripts', 'scale_lite_load_gmaps_v3', 50 );
    176174add_action('admin_enqueue_scripts', 'scale_lite_load_gmaps_v3', 50 );
    177175
     
    188186  return $good_protocol_url;
    189187}
     188
     189function a() {
     190  global $post;
     191  if(has_shortcode($post->post_content,'sl_gmaps')) {
     192    // execute code only if there is a sl_gmaps shortcode on the page
     193    add_action('wp_enqueue_scripts', 'scale_lite_build_markers_array', 10 );
     194    add_action('wp_enqueue_scripts', 'register_markers_array', 10 );
     195    add_action('wp_enqueue_scripts', 'scale_lite_load_gmaps_v3', 50 );
     196    add_action('wp_enqueue_scripts', 'scale_lite_load_sl_maps_js', 10 );
     197  }
     198}
     199add_action('wp_enqueue_scripts','a');
Note: See TracChangeset for help on using the changeset viewer.