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 ...
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 ...
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
...
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:
...
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 ...
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' );...
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 = ...
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 ...
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");
}
...
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 ...
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 ...
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=...
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 ...
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(){
...
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', '...
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 (....
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 ...
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 ...
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 ...
1
vote
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-...
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 ...
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
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 ...
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',...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
jquery-ui × 140jquery × 80
javascript × 23
plugins × 18
plugin-development × 16
wp-enqueue-script × 16
ajax × 15
php × 11
wp-admin × 10
datepicker × 9
autocomplete × 8
admin × 7
css × 5
metabox × 5
tinymce × 4
wp-enqueue-style × 4
functions × 3
theme-development × 3
widgets × 3
dashboard × 3
slideshow × 3
tabs × 3
menus × 2
templates × 2
html × 2