Trigger Submit Event when Widget is added to Sidebar

Based off the example @mrwweb provided above and some additional code, here is an answer that works. This answer forces a widget to save when a widget is added to a sidebar. It finds all the “Save” buttons and triggers their click event thus saving the widget. The count variable is used to stop an … Read more

How can I loop into two different DIVS without repeating the DIVs

The key, I think, to what you are doing is to use “offset” <div class=”col4 inner-left”> <ul class=”popular-list”> <?php query_posts(‘order=DESC&posts_per_page=3&post_type=pop’); if (have_posts()) : while (have_posts()) : the_post(); ?> <li> <a href=”https://wordpress.stackexchange.com/questions/125200/<?php the_permalink(); ?>”><?php the_title(); ?></a> </li> <?php endwhile; endif; ?> </ul> </div> <div class=”col4 inner-right”> <ul class=”popular-list”> <?php query_posts(‘order=DESC&posts_per_page=3&post_type=pop&offset=3’); if (have_posts()) : while (have_posts()) : … Read more

Get ACF value in external jQuery document

Your question is not entirely clear, but it looks like you are in need of wp_localize_script, which allows you to pass variables from PHP to a script. You would use it like this (example with two fields): add_action (‘wp_enqueue_scripts’,’wpse244551_add_field’); function wpse244551_add_field () { $my_field = array (); $my_field[] = array (field1 => get_field (‘field1’)); $my_field[] … Read more

Using JavaScript and JQuery in Page

jQuery is default active in WP, no need to enable it. There are 2 ways of including your own jQuery in WP: Enqueue your own file containing the jQuery (preferred method) Use the wp_head or wp_footer action hook to include a script with jQuery. I’m only going to explain how to enqueue scripts in WP. … Read more

POST from jQuery to PHP

When you load your process.php file directly, it’s not within the context of the WordPress environment, so no WordPress functions are available. WordPress has a native AJAX API that should be used for this sort of thing. First, enqueue your javascript file, then use wp_localize_script to pass the location of admin-ajax.php, which will be processing … Read more

Add jQuery to WordPress page

I think wordpress only loads jQuery when you specify it is a dependency for another script that is loading on that page: wp_enqueue_script( ‘script-name’, ‘/path/script.js’, array(‘jQuery’); If there is no other script then try loading it like a normal script with full path to the file: wp_enqueue_script( ‘myJquery’, ‘//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js’);

jQuery Hoverintent plugin in TwentyEleven Menu [closed]

Here is the code I have in my functions.php file: /** * Hoverintent Plugin for the menu * @since Theme 1.0 */ function theme_hover_menu() { wp_register_script(‘hoverintent_script’, get_template_directory_uri() . ‘/js/hoverintent.js’, array(‘jquery’), ‘r6’ ); wp_enqueue_script(‘hoverintent_script’); } add_action(‘wp_enqueue_scripts’, ‘theme_hover_menu’); This is step 1… Next? Comments? Solutions? I will edit this post once I will have found the answer. … Read more

WordPress loads whole jQuery UI library

jQuery-UI is included in every default WP installation. Whether it is loaded depends on your theme and/or plugin(s). Three Options: live with it disable plugins one by one (and switch theme), figure out which is responsible and whether that’s needed manually deregister it (something, i.e. a plugin, will probably break)