I’m trying to set the cookie to my site to button on click action ,it is working on when user logged in .When user logged out it’s not working

Your script uses jQuery so you should make sure that: jQuery is enqueued on your site (it may be for logged-in users, especially admins, but not necessarily for logged-out users) your script is added with jQuery as a dependency so jQuery is available when your script runs I would use wp_add_inline_script() for this, like so: … Read more

WordPress error when replacing local jQuery by externally-hosted

The error message describes your problem quite clearly: Notice: wp_deregister_script was called incorrectly. Do not deregister the jquery script in the administration area. To target the front-end theme, use the wp_enqueue_scripts hook. You’re de-registering the script on the init hook: add_action(‘init’, ‘replace_jquery’); This hook runs for the back and front end, but the debugger isn’t … Read more

How register library to use jquery correct

You should use the built-in version of jQuery for compatibility reasons. All you need to do is to enqueue it: function theme_scripts() { wp_enqueue_script(‘jquery’); } add_action(‘wp_enqueue_scripts’, ‘theme_scripts’); Or just add it as a dependency for your script: function theme_scripts() { wp_enqueue_script( ‘my-script’, <PATH>, array(‘jquery’), … ); } add_action(‘wp_enqueue_scripts’, ‘theme_scripts’); But then… you have to remember, … Read more

Gutenberg – Title field required

You could use PluginPrePublishPanel to check for the title and lock publishing if it’s empty. Have a look at the accepted answer here for an example of locking the post – Add pre-publish conditions to the block editor For your example you could modify the checking portion as follows: const { registerPlugin } = wp.plugins; … Read more

Simple text and image slider

I use jQuery Scrollable for all my slider needs. It supports sliding of any type of content, and content can slide horizontally and vertically. JQuery Tools and JQuery Scrollable are free, open sourced, and well documented. The support forums can be very useful if you are having problems implementing scrollable.

How to fix my old theme so it loads jQuery properly

Taking a stab at a general answer, since we don’t (yet?) have access to the specific Theme. Note: all of these edits can – and perhaps should – be implemented via Child Theme. First, you need to remove ALL of those lines from header.php. Scripts should be enqueued, rather than hard-coded into the template. Then, … Read more

filterable portfolio with wordpress and jquery

When enqueueing scripts in a child theme directory, use get_stylesheet_directory_uri() instead of get_template_directory_uri(). In the case of a child theme, get_template_directory_uri() will return the parent theme’s directory. function enqueue_filterable(){ wp_register_script( ‘filterable’, get_stylesheet_directory_uri() . ‘/js/filterable.js’, array( ‘jquery’ ) ); wp_enqueue_script( ‘filterable’ ); } add_action( ‘wp_enqueue_scripts’, ‘enqueue_filterable’ );

url – ajax loaded but no JS

Try this code in your complete callback of the load function: $(“.postbox_wrapper”).load( jQuery(this).attr(“href”) + ” .postbox_wrapper”, function(response, status, xhr) { // complete callback // create a empty div var div = document.createElement(‘div’); // fill div with response div.innerHTML = response; // take correct part of the response var ref = $($(div).find(‘.postbox_wrapper’).html()); // filter response for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)