WordPress plugin: Multi-level Navigation Plugin
På thylander.dk bruger jeg Multi-level Navigation Plugin til WordPress lavet af Pixopoint
Det er et plugin der giver mulighed for at lave en god gammel dropdown menu navigation.
Jeg fandt ud af, at den fik sitet til at køre langsommere, og har derfor lavet to nedenstående rettelser. Nogen kunne måske finde det interessant?
In core.php I have included the get_options, so it passes the values via URL to scripts/hoverIntent.js.php:
wp_register_script('hoverIntent', $javascript_location.'hoverIntent.js.php?sensitivity='
.( get_option('suckerfish_superfish_sensitivity') == 'high' ? '10' : '')
.( get_option('suckerfish_superfish_sensitivity') == 'average' ? 5 : 0)
.( get_option('suckerfish_superfish_sensitivity') == 'low' ? 1 : 0)
.'&interval='.get_option('suckerfish_superfish_delaymouseover')
, array('jquery'), 'r5');
wp_register_script('superfish', $javascript_location.'superfish.js', array('hoverIntent'), '1.4.8');
wp_register_script('superfish_init', $javascript_location.'superfish_settings.js.php?delay='
.get_option('suckerfish_delay')
.'&speed='.( get_option('suckerfish_superfish_speed') == 'instant' ? '1' : get_option('suckerfish_superfish_speed') )
.'&arrows='.get_option('suckerfish_superfish_arrows')
.'&shadows='.get_option('suckerfish_superfish_shadows')
, array('superfish'), '1.0');
wp_register_script('sfdelay', $javascript_location.'sfdelay.js','', '1.0');
In hoverIntent.js.php I can now exclude the wp_load.php inclusion:
//require_once("../../../../wp-load.php");
and use the parameters passed via the url:
sensitivity: <?php echo ($_GET['sensitivity'] ? $_GET['sensitivity'] : 10); //Â Â Â if (get_option('suckerfish_superfish_sensitivity') == 'high') {echo '10';}?>,
interval: <?php echo ($_GET['interval'] ? $_GET['interval'] : 0); //echo get_option('suckerfish_superfish_delaymouseover'); ?>,
timeout: 0
In superfish_settings.js.php I can exclude the wp-load.php:
//require_once("../../../../wp-load.php");
and use the parameters passed via the url:
delay: ' . $_GET['delay'] . ', // delay on mouseout speed: ' . $_GET['speed'] . ', // animation speed autoArrows: "' . $_GET['arrows'] . '", // enable generation of arrow mark-up dropShadows: "' . $_GET['shadows'] . '" // enable drop shadows
style.php is also slow (because it includes wp-load.php). The solution I use at the moment is to copy the css to the theme css, and bypass style.php all together. Maybe a better solution could be found…
Skriv en kommentar