Skip to main content
39 votes
Accepted

Correct way to enqueue jquery-ui

First of all, WordPress registers jQuery UI via wp_default_scripts(). Dependencies are already set, so you only need to enqueue the script you really need (and not the core). Since you're not changing ...
kero's user avatar
  • 6,290
8 votes

Check if user is logged in using JQuery

Please note that none of the above examples are reliable in case you use a page cacheing plugin, then the code in body tag will be static. Also there is a simple way to do this (with no extra query to ...
Janos Szabo's user avatar
8 votes
Accepted

possible to make sections in theme customizer sortable and saveable at publish button clicked?

Simple tutorial - How to sort customizer sections in the panel and add order to theme. 1. You must use prefixes to do this because customizer don't support custom classes. ctmss_panel_ - for panels ...
Michael's user avatar
  • 182
6 votes

Correct way to enqueue jquery-ui

If you are enqueuing your own script, you can just add 'jquery-ui-accordion', for example, to the list of dependencies. All the required dependencies will be added automatically. Example: ...
Greg Perham's user avatar
4 votes
Accepted

Wordpress doesn't Load JQuery Now? Do I need to enqueue JQuery also?

Your issue is that you are trying to use the normal jQuery shortcut ($) which doesn't work by default as the WordPress version of jQuery is in compatibility mode. You need to wrap the code in your ...
Erbilacx's user avatar
  • 391
4 votes

How do I implement a jQuery UI dialog modal in a WP plugin?

You should do these: add_action( 'admin_enqueue_scripts', 'admin_scripts' ); function admin_scripts(){ wp_enqueue_script( 'jquery-ui-dialog' ); wp_enqueue_style( 'wp-jquery-ui-dialog' );...
T.Todua's user avatar
  • 5,850
3 votes

How to override wp-admin styling

As noted by @Fusion, this has changed beginning with version 5. In order to override admin styles for 5.*, you need a hook in functions.php, something like this: function custom_admin() { $url = ...
samurai_jane's user avatar
3 votes

How to load an additional script for a block in the block editor?

BUT, for some reason, the accordion function from jQuery UI doesn't get attached to the .accordion class of my block in the block editor, so the accordion effect doesn't work. The ServerSideRender ...
Sally CJ's user avatar
  • 39.9k
2 votes

How do I use jQuery UI tabs in a WordPress page?

WordPress has already lot of UI effects. documentation Step 1. Add the effect to the functions.php file of the theme function add_theme_scripts() { wp_enqueue_script("jquery-ui-tabs"); } ...
Khandaker Toihidul Islam's user avatar
2 votes
Accepted

Adding jQuery UI elements to WordPress page

Using jquery-ui widgets requires a couple of steps. You will need to add the appropriate markup for your widget. I'll use the slider as an example. I just created a new page and added the markup ...
Tim Elsass's user avatar
  • 1,343
2 votes

JqueryUi Dialog giving Uncaught TypeError: this._addClass is not a function error

Your JS looks to be written inline vs. in its own JS file or at least enqueued on its own. In other words, it doesn't look like its being loaded properly re WordPress. Note the WP function ...
firxworx's user avatar
  • 241
2 votes
Accepted

splitting the URL using jQuery

Not really a WordPress related question but you could do this // creates a object from the array, one of the properies (search) contains the query let url = new URL('https://dev/job/?job_id=...
Buttered_Toast's user avatar
1 vote

Uncaught TypeError: jQuery(...).slider is not a function

The error message is clear; the function is not exist. It would help if you looked at your dependencies. You need jQuery Core, the jQuery UI library, and the jQuery Slider library. But no worries, you ...
bueltge's user avatar
  • 17.1k
1 vote

How to load an additional script for a block in the block editor?

A bit late, but mabe will help someone :) I fixed this with a simple setInterval() that clears itself as soon element is on page: (function($){ var blockSliderInterval = setInterval(function(){ ...
Gleb Makarov's user avatar
1 vote

How to override wp-admin styling

Enqueue custom admin CSS file (custom-admin.css) in your WordPress backend using below function: add_action('admin_print_styles', 'custom_admin_css'); add_action('wp_enqueue_scripts', '...
dhirenpatel22's user avatar
1 vote
Accepted

datepicker for custom post type admin

Issues I noticed in your code I don't see where/how you're calling that custom datepicker() function and you should use the same admin_enqueue_scripts hook for registering/enqueueing a stylesheet (....
Sally CJ's user avatar
  • 39.9k
1 vote
Accepted

How can i unload effect.min.js file?

If you want to remove Effect Core the you have to remove depended scripts too. Follow this to remove them: add_action( 'wp_enqueue_scripts', 'remove_jquery_effects', 100 ); function ...
Sabbir Hasan's user avatar
  • 1,389
1 vote

JqueryUi Dialog giving Uncaught TypeError: this._addClass is not a function error

I got here debugging the same error on my WP installation. The previous answer was for developer of plugin/theme, so being an admin, I needed a little different approach. I had to find the source of ...
kub1x's user avatar
  • 121
1 vote

Problems with creating sortable sections in customizer

When you add a new field for customisation, WordPress handles how the values are saved, retrieved, previewed. Then you don't have to save the value with a AJAX call. You just have to add the new ...
mmm's user avatar
  • 3,795
1 vote

Jquery not showing in homepage

your live site jquery code ( missing (function($) {
Tarang koradiya's user avatar
1 vote

Correct way to enqueue jquery-ui

I've modified your script. try with this, it is working. add_action( 'wp_enqueue_scripts', array($this, 'enqueue_scripts') ); public function enqueue_scripts() { wp_enqueue_script( 'jquery-ui-...
umesh.nevase's user avatar
1 vote

jQuery UI tab does not work in the plugin page

First check all the JS files are loaded properly by going to Chrome Developer Tools. Also check if any other script is causing any error or not. You can check this by Chrome Dev Tools. Some ...
CodeMascot's user avatar
  • 4,537
1 vote

jQuery UI Datepicker error

The script itself is no longer on the google hosted link. You should try updating to Wordpress v4.7.1 or reporting the bug if it still persists after that
Tunji's user avatar
  • 2,961
1 vote
Accepted

Open tab on current day problem jQuery and Wordpress

Your problem is one of formatting: <?php add_action( 'wp_footer', 'wpse203799_footerscript', '30' ); }?> There's a very good reason that programmers follow coding standards, and use editors ...
Tom J Nowell's user avatar
  • 60.6k
1 vote

Check if user is logged in using JQuery

I am using an alternative way without ajaxurl and body class. I just don't trust the body class, that might not exist in all of the themes. In functions.php you should have: add_action( 'wp_body_open',...
Sisalik's user avatar
  • 11
1 vote

Check if user is logged in using JQuery

Thanks to this post and another post, I found a solution to my issue. I'm just posting in case anyone might find it useful. Works on current WordPress sites This code checks if user is logged or not ...
Jiyoon's user avatar
  • 11

Only top scored, non community-wiki answers of a minimum length are eligible