Community Forums › Forums › Archived Forums › General Discussion › Superfish deactivation snippet not working.
Tagged: Disable Superfish
- This topic has 10 replies, 4 voices, and was last updated 8 years, 6 months ago by studionoobly.
-
AuthorPosts
-
May 3, 2016 at 4:24 am #184878studionooblyMember
Hi,
I'm using (from what I can tell) the well tested and well used snippet below to prevent the superfish scripts from loading on to a website that I'm building (locally) but it doesn't seem to work? I've tried clearing my cache reloading a bunch of times but they still turn up every time. Is anyone else having this issue, does anyone know of sure fire way get rid of these scripts?
add_action( 'custom_disable_superfish', 'mb_unregister_superfish' ); function mb_unregister_superfish() { wp_deregister_script( 'superfish' ); wp_deregister_script( 'superfish-args' ); }
Thanks
http://localMay 3, 2016 at 4:41 am #184879Brad DaltonParticipantWhere did you put the code?
Here's the SP code which always works https://gist.github.com/studiopress/5570624
May 3, 2016 at 4:50 am #184880studionooblyMemberThanks Brad
But it still seems to be getting it from "wp-content/themes/genesis/lib/js/menu/superfish.min.js" I have the code at the bottom of my functions.php, I have tested in a different browser in private mode and they still turn up?
May 3, 2016 at 5:27 am #184887Victor FontModeratorThe action you are supposed to be using is wp_enqueue_scripts not custom_disable_superfish. There is no WordPress action for custom_disable_superfish. This is the correct code:
add_action( 'wp_enqueue_scripts', 'sp_disable_superfish' ); function sp_disable_superfish() { wp_deregister_script( 'superfish' ); wp_deregister_script( 'superfish-args' ); }
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?May 3, 2016 at 5:35 am #184889studionooblyMemberThanks Victor, but that is the same code as Brad linked too.
May 3, 2016 at 7:35 am #184898Victor FontModeratorThat is the correct code. Your code is trying to add an action that doesn't exist.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?May 3, 2016 at 8:11 am #184901studionooblyMemberYes, I know it's the correct code, what I'm saying is that I replaced the old code with the one you and Brad provided and that did not work either.
ThanksMay 12, 2016 at 5:00 pm #185499joellereederMemberI'm actually experiencing this same issue. I'm using the exact snippet posted here by Victor, which is the same one found in the Genesis Snippets. No matter where I place it in the functions file, it does not disable Superfish.
I am using Genesis 2.27, I've got a Genesis sample child theme going with very minimal customizations thus far and I've even tried turning off all of the plugins to see if that resolved the conflict.
But no, that snippet does not disable superfish. Any ideas?
Thanks! 🙂
May 13, 2016 at 2:32 am #185546studionooblyMemberI'm afraid not, I think I have tried all the same things you have but they still don't go? The only thing I can think but haven't tried is going through all the code I have added to my custom theme functions file and temporarily block out each one, then reload the browser after each try and see if it's something else that is blocking that bit of code. Given the amount of code I have in that file it could take a while. If I find anything I'll let you know.
May 13, 2016 at 3:57 am #185552Victor FontModeratorDo you have accessibility support activated for drop down menus? If so, you won't be able to deactivate superfish until you remove accessibility support for drop down menus. This is the function that checks for superfish support:
function genesis_superfish_enabled() { return ( ! genesis_html5() && genesis_get_option( 'superfish' ) ) || genesis_a11y( 'drop-down-menu' ) || apply_filters( 'genesis_superfish_enabled', false ); }
That function returns true if drop down menu support for accessibility is active. Look in functions.php for accessibility support:
//* Add accessibility support add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );
Remove 'drop-down-menu',
Add apply_filters( 'genesis_superfish_enabled', false ); to the file and superfish is deactivated. I just tested this on Digital Pro in my local environment.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?May 13, 2016 at 4:59 am #185559studionooblyMemberYus!
Thanks Victor, that did the trick. Average load time on my pages now (on an regular 2G network) is down to about 2 seconds.
Thanks,
Noah
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.