newleaves
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Hacks
In reply to: $GLOBALS['wp_scripts'] is emptyok, i was hoping there was a common pitfall for ending up with an empty wp_scripts. i’ll dig around some more.
I just need the version of the default registered jquery. googleapis cdn hasn’t added 1.12.3 to their line-up yet, so i’m using this snippet to prevent a missing jquery.js file from bringing the site down:$system_jquery = $GLOBALS['wp_scripts']->registered['jquery']; wp_deregister_script('jquery'); wp_deregister_script('jquery-migrate'); wp_enqueue_script('jquery', "//ajax.googleapis.com/ajax/libs/jquery/{$system_jquery->ver}/jquery.min.js", [], $system_jquery->ver, true); add_filter('script_loader_src', function($src, $handle = null) use($system_jquery){ static $add_jquery_fallback = false; if ($add_jquery_fallback) { ?> <script>window.jQuery || document.write('<script src="//code.jquery.com/jquery-<?= $system_jquery->ver ?>.min.js"><\/script>')</script> <script>window.jQuery || document.write('<script src="<?= includes_url('/js/jquery/jquery.js') ?>"><\/script>')</script> <script>if ($ !== window.jQuery) $ = window.jQuery</script> <? } $add_jquery_fallback = ($handle === 'jquery'); return $src; }, 10, 2);Forum: Plugins
In reply to: [Auto Submenu] Only children, not top-levelin case anyone else needs this https://github.com/co-b/auto-submenu
This fork enables auto-adding subpages to all menus without needing to check “automatically add top level pages”.
This prevents the issue where a client adds a new parentless page and it automatically gets appended to every existing menu.
Viewing 2 replies - 1 through 2 (of 2 total)