Convert UL to dropdown list not working

@CharlieJustUs when you use Fiddle is automatically sets the $ variable for you. When your script tries to run on your site, that variable is not set, and it fails. Try this please. jQuery(document).ready(function($) { $(function() { $(‘ul.clearfix’).each(function() { var $select = $(‘<select class=”dropdown-toggle” />’); $(this).find(‘a’).each(function() { var $option = $(‘<option />’); $option.attr(‘value’, $(this).attr(‘href’)).html($(this).html()); $select.append($option); … Read more

Adding toggle-able element after menu item

You can easily add any HTML element to all menu items that have children by extending the Walker_Nav_Menu core class. The code below will add <i> icon element just after menu item </a> tag but you can of course change that if you need them inside or somewhere else by changing the $item_output variable. function … Read more

How do I use jQuery to add the TinyMCE WYSIWYG editor to a textarea?

I would just use the WordPress JavaScript API for TinyMCE — wp.editor. The steps in brief: PHP: Enqueue the editor scripts (and styles) via wp_enqueue_editor(). JS: Call wp.editor.initialize() from your script. And do take note of this: (the “this function” refers to wp.editor.initialize) If this function does nothing, please make sure that wp.editor.getDefaultSettings is a … Read more

Stop wordpress from requesting external jquery from googleapi

WordPress doesn’t use externally hosted jQuery. In fact, as far as I’m aware, WordPress core does not register any externally hosted scripts. WordPress bundles its own version of jQuery, and you can enqueue the bundled version by just enqueueing the handle jquery: wp_enqueue_script( ‘jquery’ ); Or by specifying ‘jquery’ as a dependency: wp_enqueue_script( ‘my-script’, ‘/path/to/my-script.js’, … Read more

Adding JavaScript file in Admin Panel

Yes, your code is good. And that my_custom_script is a unique identifier for the script you’re enqueueing. You can find the default script handlers/identifiers here — e.g. jquery for the jQuery library that ships with WordPress. There you can also find more details about the wp_enqueue_script() function, e.g. where should you use the function, the … Read more

Disable Cloudflare Rocket Loader for jQuery javascript and make it load first

jQuery is loaded by WordPress with wp_enqueue_script. The problem is WordPress also use the below code to change the handle public function localize( $handle, $object_name, $l10n ) { if ( ‘jquery’ === $handle ) { $handle=”jquery-core”; } The solution is to use the function function wpse_script_loader_tag( $tag, $handle ) { if ( ‘jquery-core’ !== $handle … Read more