Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Re-registers and enqueues scripts to use the correct protocol */
- add_action( 'wp_enqueue_scripts', '04062012_fix_protocol', 10 );
- add_action( 'admin_enqueue_scripts', '04062012_fix_protocol_admin', 10 );
- /*
- * Fixes how Fancybox enqueues scripts and styles so that
- * they will be included with the correct protocol (i.e. https)
- * Specific to the frontend, see also 04062012_fix_protocol_admin()
- */
- function 04062012_fix_protocol() {
- $settings = get_option( 'mfbfw' );
- // Check if script should be loaded in footer
- if ( isset($settings['loadAtFooter']) && $settings['loadAtFooter'] ) {
- $footer = true;
- } else {
- $footer = false;
- }
- // Check if plugin should not call jQuery script (for troubleshooting only)
- if ( isset($settings['nojQuery']) && $settings['nojQuery'] ) {
- $jquery = false;
- } else {
- $jquery = array('jquery');
- }
- wp_dequeue_style( 'fancybox' );
- wp_dequeue_style( 'jquery-ui' );
- wp_deregister_script( 'fancybox' );
- wp_deregister_script( 'jqueryeasing' );
- wp_deregister_script( 'jquerymousewheel' );
- wp_enqueue_style( 'fancybox', plugins_url( 'fancybox-for-wordpress/fancybox/fancybox.css' ) );
- wp_enqueue_style( 'jquery-ui', plugins_url( 'fancybox-for-wordpress/css/jquery-ui.css' ) ); // Load jQuery UI Tabs CSS for Admin Page
- wp_register_script( 'fancybox', plugins_url( 'fancybox-for-wordpress/fancybox/jquery.fancybox.js' ), $jquery, '1.3.4', $footer ); // Main Fancybox script
- wp_register_script( 'jqueryeasing', plugins_url( 'fancybox-for-wordpress/js/jquery.easing.1.3.min.js' ), false, '1.3', $footer ); // Main Fancybox script
- wp_register_script( 'jquerymousewheel', plugins_url( 'fancybox-for-wordpress/js/jquery.mousewheel.3.0.4.pack.js' ), false, '3.0.4', $footer ); // Main Fancybox script
- }
- /*
- * Fixes how Fancybox enqueues scripts and styles so that
- * they will be included with the correct protocol (i.e. https)
- * Specific to admin styles and scripts
- */
- function 04062012_fix_protocol_admin() {
- wp_dequeue_style( 'fancybox-admin' );
- wp_dequeue_script( 'fancybox-admin' );
- wp_enqueue_style( 'fancybox-admin', plugins_url( 'fancybox-for-wordpress/css/fancybox-admin.css' ) ); // Load custom CSS for Admin Page
- wp_enqueue_script( 'jquery-ui-core' ); // Load jQuery UI Core JS for Admin Page
- wp_enqueue_script( 'jquery-ui-tabs', array( 'jquery-ui-core' ) ); // Load jQuery UI Tabs JS for Admin Page
- wp_enqueue_script( 'fancybox-admin', plugins_url( 'fancybox-for-wordpress/js/admin.js' ), array( 'jquery' ) ); // Load specific JS for Admin Page
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement