New answers tagged

2 votes
Accepted

How to use Javascript to get data from a Wordpress form

This approach should work, Modify it for your use case. //JQuery Code jQuery( document ).on( 'change', '.from-this', function( e ) { e.preventDefault(); jQuery( '.change-this' ).text( this....
Syed Muhammad Usman's user avatar
1 vote

How to use wp_localize_script in custom page template?

wp_register_script('nags-quoting-main-js', NAGS_QUOTING_PLUGIN_URL . 'assets/js/main.js', array(), '', true); $nags_post_url = NAGS_QUOTING_PLUGIN_URL . 'post.php'; $use_google_api_key = get_option(...
Rajon Kobir's user avatar
1 vote
Accepted

Post current post type to my Ajax

To pass the current post type to your AJAX request, you need to modify your JS to include the post type information in the AJAX request. You can achieve this by adding the post type as a parameter ...
vijay pancholi's user avatar
1 vote

Post current post type to my Ajax

Hi please replace your ajax function like this function filterPosts() { $show_post_types = get_post_types(); $post_type_array = array(); foreach ($show_post_types as $pt) { ...
Pratik bhatt's user avatar
  • 1,230
1 vote
Accepted

How to add an additional dependency to a block index.asset.php file

Actually, you do not need to worry about adding the Masonry's script handle to the dependencies array in the asset file (index.asset.php). All you needed to do to make your Masonry code work properly ...
Sally CJ's user avatar
  • 38.7k
1 vote

Trying to deque some .js from source

wp_print_scripts hook with set high priority instead of default 10 function dequeue_custom_scripts() { // Make sure to use the correct URLs of the scripts you want to dequeue $...
vijay pancholi's user avatar
0 votes

Translating the "Everything" filter menu in Quicksand jquery file

You should be able to pass the language across using wp_localize_script(). So you're obviously enqueuing your own custom javascript file, lets say that file is called createlist.js. I assume you're ...
Tony Djukic's user avatar
  • 2,010
1 vote
Accepted

useSelect() plus resolver result is serving cached data incorrectly

Thanks for MVE, @helgatheviking! It was beneficial. When wp.data caches the resolvers, it also considers arguments. Here's what happens when following the reproduction steps for the bug: Selecting ...
Mamaduka's user avatar
  • 4,492
2 votes

Insert text programmatically in WordPress Gutenberg Editor

To insert or modify text in the Gutenberg Rich Text Editor when a menu choice is selected, you need to interact with the Gutenberg block editor's rich text APIs. Here's a general approach to achieve ...
WordPress Buddha's user avatar
0 votes

Processing javascript on wordpress

You can use a plugin to add the code where you need it. Instead of the javascript you show above you add a shortcode that makes your javascript show on the page as expected. I use a plugin called ...
WordPress Buddha's user avatar
1 vote

Processing javascript on wordpress

The script tags are only there to contain the JavaScript that will be executed by the browser. You need to tell WordPress to ignore those tags so it doesn't process them as HTML. One way to do this is ...
Elijah O.'s user avatar
1 vote

enqueue_custom_scripts isn't working

Based on the information you've provided, there are a few potential reasons why your script might not be enqueued properly in WordPress. Let's troubleshoot: Try cache busting: It is possible the file ...
WordPress Buddha's user avatar

Top 50 recent answers are included