Example #1
0
function am_load_javascript()
{
    //Register external plugins
    wp_register_script('plugins', JSPATH . '/vendor/plugins.js', '', '1.0', true);
    // Register all scripts
    wp_register_script('main', JSPATH . '/main.js', array('jquery'), '1.0', true);
    // Google maps for maplace
    wp_register_script('google-maps', 'http://maps.google.com/maps/api/js?sensor=false&libraries=geometry&', array('jquery'), '3.7', true);
    // Localized Scripts
    // Slides Array
    wp_localize_script('main', 'am_slide_array', am_get_slides());
    // Pages data
    wp_localize_script('main', 'am_pages', am_get_post_data(am_get_post_ids('page')));
    // Testimonials
    wp_localize_script('main', 'am_testimonials', am_get_post_data(am_get_post_ids('testimonial')));
    // Ajax URL
    wp_localize_script('main', 'ajaxurl', admin_url('admin-ajax.php'));
    // Slider DOM
    wp_localize_script('main', 'am_files_variables', am_files_to_variables(array('content-slider.php', 'content-carousel.html')));
    // Enqueue wordpress js plugins
    wp_enqueue_script('underscore');
    wp_enqueue_script('google-maps');
    wp_enqueue_script('plugins');
    wp_enqueue_script('main');
}
function am_get_slides($data_type = '')
{
    $slideIDArray = am_get_post_ids('slide');
    $slides_data = am_get_post_data($slideIDArray, $data_type);
    return $slides_data;
}