Ejemplo n.º 1
0
/**
 * Add more JavaScript files to customizer admin
 */
function lbmn_add_customizer_js()
{
    wp_enqueue_media();
    // need this to make WP Media Library to work
    wp_enqueue_script('lbmn_customizer_tinycolor_js', get_template_directory_uri() . '/inc/customizer/jquery-colorpickersliders/jquery.colorpickersliders.js', array('jquery'), '20140303', true);
    wp_enqueue_script('lbmn_customizer_customcolorpicker_js', get_template_directory_uri() . '/inc/customizer/jquery-colorpickersliders/tinycolor.js', array('jquery', 'lbmn_customizer_tinycolor_js'), '20140303', true);
    wp_enqueue_style('lbmn_customizer_customcolorpicker_css', get_template_directory_uri() . '/inc/customizer/jquery-colorpickersliders/jquery.colorpickersliders.css');
    wp_enqueue_script('lbmn_customizer_adminjs', get_template_directory_uri() . '/inc/customizer/customizer-admin.js', array('jquery'), '20150818', true);
    //  array( 'jquery', 'iris', 'wp-color-picker' )
    wp_enqueue_style('lbmn_customizer_adminstyle', get_template_directory_uri() . '/inc/customizer/customizer-admin.css', array(), '20150315');
    // Prepare some data to be transmitted to JS
    $customizerData = array('fontPresetsWeights' => lbmn_return_font_presets_weights());
    // MegaMainMenu isn't installed - show a message using JS
    if (!is_plugin_active('mega_main_menu/mega_main_menu.php')) {
        $customizerData['notInstalled_MegaMainMenu'] = 1;
    }
    // LiveComposer isn't installed - show a message using JS
    if (!is_plugin_active('mega_main_menu/mega_main_menu.php') || !is_plugin_active('ds-live-composer/ds-live-composer.php') || !is_plugin_active('meta-box/meta-box.php')) {
        $customizerData['notInstalled_requiredPlugin'] = 1;
    }
    // No menu assigned to the location 'header-menu'
    if (!has_nav_menu('header-menu')) {
        $customizerData['notAssigned_HeaderMenu'] = 1;
    }
    if (!has_nav_menu('topbar')) {
        $customizerData['notAssigned_TopBar'] = 1;
    }
    // Send data to JS
    wp_localize_script('lbmn_customizer_adminjs', 'customizerDataSentOnLoad', $customizerData);
    // Chosen Jquery selector with search by HARVEST
    // used fot Google Fonts selectors
    wp_enqueue_script('lbmn_chosen_selectorjs', get_template_directory_uri() . '/javascripts/chosen/chosen.jquery.min.js', array('jquery'), '20131215', true);
    wp_enqueue_style('lbmn_chosen_selectorcss', get_template_directory_uri() . '/javascripts/chosen/chosen.css');
    // Include Mega Main Menu scripts and css to make iconpciker work
    // DOESN'T WORK WITH UPDATED MEGA MAIN MENU PLUGIN ANYMORE
    /*
    if(is_plugin_active('mega_main_menu/mega_main_menu.php')) {
    	global $mega_main_menu;
    	// Get array of all the scripts to load defined in
    	// plugins/mega_main_menu/extensions/array_src/array_src.php
    	$ware_src_array = mega_main_menu__array_src();
    	// $ware_src_array = $ware_src_array['backend'];
    
    
    	foreach ( $ware_src_array[ 'backend' ][ 'css' ] as $key => $value ) {
    		wp_register_style( $key, $mega_main_menu->constant[ 'MM_WARE_CSS_URL' ] . $value );
    		wp_enqueue_style( $key );
    	}
    	foreach ( $ware_src_array[ 'backend' ][ 'js' ] as $key => $value ) {
    		if ( $value != '' ) {
    			wp_register_script( $key, $mega_main_menu->constant[ 'MM_WARE_JS_URL' ] . $value, 'jquery', false, true );
    		}
    		wp_enqueue_script( $key );
    	}
    
    }
    */
}
Ejemplo n.º 2
0
/**
 * Add more JavaScript files to customizer admin
 */
function lbmn_add_customizer_js()
{
    wp_enqueue_media();
    // need this to make WP Media Library to work
    wp_enqueue_script('lbmn_customizer_tinycolor_js', get_template_directory_uri() . '/inc/customizer/jquery-colorpickersliders/jquery.colorpickersliders.js', array('jquery'), '20140303', true);
    wp_enqueue_script('lbmn_customizer_customcolorpicker_js', get_template_directory_uri() . '/inc/customizer/jquery-colorpickersliders/tinycolor.js', array('jquery', 'lbmn_customizer_tinycolor_js'), '20140303', true);
    wp_enqueue_style('lbmn_customizer_customcolorpicker_css', get_template_directory_uri() . '/inc/customizer/jquery-colorpickersliders/jquery.colorpickersliders.css');
    wp_enqueue_script('lbmn_customizer_adminjs', get_template_directory_uri() . '/inc/customizer/customizer-admin.js', array('jquery'), '20150818', true);
    //  array( 'jquery', 'iris', 'wp-color-picker' )
    wp_enqueue_style('lbmn_customizer_adminstyle', get_template_directory_uri() . '/inc/customizer/customizer-admin.css', array(), '20150315');
    // Prepare some data to be transmitted to JS
    $customizerData = array('fontPresetsWeights' => lbmn_return_font_presets_weights());
    // MegaMainMenu isn't installed - show a message using JS
    if (!is_plugin_active('mega_main_menu/mega_main_menu.php')) {
        $customizerData['notInstalled_MegaMainMenu'] = 1;
    }
    // LiveComposer isn't installed - show a message using JS
    if (!is_plugin_active('mega_main_menu/mega_main_menu.php') || !is_plugin_active('ds-live-composer/ds-live-composer.php') || !is_plugin_active('meta-box/meta-box.php')) {
        $customizerData['notInstalled_requiredPlugin'] = 1;
    }
    // No menu assigned to the location 'header-menu'
    if (!has_nav_menu('header-menu')) {
        $customizerData['notAssigned_HeaderMenu'] = 1;
    }
    if (!has_nav_menu('topbar')) {
        $customizerData['notAssigned_TopBar'] = 1;
    }
    // Strings in the JS that needs translation
    $js_strings_to_translate = array('beforeHeader' => __('Before Header', 'lbmn'), 'header' => __('Header', 'lbmn'), 'content' => __('Content', 'lbmn'), 'footer' => __('Footer', 'lbmn'), 'other' => __('Other', 'lbmn'), 'applyFontChanges' => __('Important: to apply font changes click <strong>"Save & Publish"</strong> on the top.', 'lbmn'), 'whereToFindFonts' => __('Find the fonts for your project in the <br /><a href="http://www.google.com/fonts/" target="_blank" class="button button-primary" style="margin-top:5px">Google Fonts directory</a>', 'lbmn'), 'linkToFooters' => __('Create a new footer or edit an existing one on the next admin page: <br /><a href="/wp-admin/edit.php?post_type=lbmn_footer" target="_blank" class="button button-primary" style="margin-top:5px">Appearance &gt; Footers</a>', 'lbmn'), 'dropdownPreview' => __('Dropdown Preview', 'lbmn'), 'nextDropdown' => __('Next Dropdown', 'lbmn'), 'close' => __('Close', 'lbmn'));
    $customizerData['strings'] = $js_strings_to_translate;
    // Send data to JS
    wp_localize_script('lbmn_customizer_adminjs', 'customizerDataSentOnLoad', $customizerData);
    // Chosen Jquery selector with search by HARVEST
    // used fot Google Fonts selectors
    wp_enqueue_script('lbmn_chosen_selectorjs', get_template_directory_uri() . '/javascripts/chosen/chosen.jquery.min.js', array('jquery'), '20131215', true);
    wp_enqueue_style('lbmn_chosen_selectorcss', get_template_directory_uri() . '/javascripts/chosen/chosen.css');
    // Include Mega Main Menu scripts and css to make iconpciker work
    // DOESN'T WORK WITH UPDATED MEGA MAIN MENU PLUGIN ANYMORE
    /*
    if(is_plugin_active('mega_main_menu/mega_main_menu.php')) {
    	global $mega_main_menu;
    	// Get array of all the scripts to load defined in
    	// plugins/mega_main_menu/extensions/array_src/array_src.php
    	$ware_src_array = mega_main_menu__array_src();
    	// $ware_src_array = $ware_src_array['backend'];
    
    
    	foreach ( $ware_src_array[ 'backend' ][ 'css' ] as $key => $value ) {
    		wp_register_style( $key, $mega_main_menu->constant[ 'MM_WARE_CSS_URL' ] . $value );
    		wp_enqueue_style( $key );
    	}
    	foreach ( $ware_src_array[ 'backend' ][ 'js' ] as $key => $value ) {
    		if ( $value != '' ) {
    			wp_register_script( $key, $mega_main_menu->constant[ 'MM_WARE_JS_URL' ] . $value, 'jquery', false, true );
    		}
    		wp_enqueue_script( $key );
    	}
    
    }
    */
}