Categories
CMS Mastering Development Wordpress

(BAD REQUEST) 400 admin-ajax.php error WordPress

I updated my WordPress to current version as it was very outdated. And now I am getting a bad request browse issue now. /wp-admin/admin-ajax.php:1 Failed to load resource: the server responded with a status of 400 (Bad Request) browser pop up. This only occurs when user is not logged in admin. I checked plugins and […]

Categories
CMS Mastering Development Wordpress

Custom Post Type Slick Slider “$ is not a function”

I’m trying to create a slider with my custom post type rt_testimonial. I believed I had everything setup but I’m getting an error in console: TypeError: $ is not a function Here’s what I did: In my mu-plugins folder in a my_functions.php I created a post type rt_testimonial. (this part is working) In my mu-plugins […]

Categories
CMS Development Wordpress

Update $wpdb query with AJAX

I display a list on my website with a custom database table : $resultats = $wpdb->get_results( $wpdb->prepare( “SELECT photo, nom, prenom, titre_fr, departement_fr FROM {$wpdb->prefix}prfs” ) ); foreach ( $resultats as $resultatPrfs ) {} Now, I have to create AJAX filters with select inputs. I’ve been trying many solutions since yesterday, but none of them […]

Categories
CMS Development Wordpress

ajax contact form not submit message

I’m havingo some trouble with a contact form I’m working on. I’m using ajax to submit it and I’ve noticed that from localhost and from the production server, the test messages I’ve sent will not be delivered. I’m not sure if it’s a network delay or if this is caused because I’m using wordpress nonces. […]

Categories
CMS Development Wordpress

why jquery is not loading in wordpress page?

I want to add jquery plugin to wordpress webpage to provide some animations. I have downloaded “jquery.plate.js” from jqueryscript.net and saved it locally in my custom themes,(js/jquery.plate.js) js folder. <script src=”//code.jquery.com/jquery-3.2.1.slim.min.js”></script> <script src=”jquery.plate.js”></script> I have added the above code in my header using “echo get_template_directory_uri();” function. not working! tried with adding following code in function.php: […]

Categories
CMS Development Wordpress

How to load jQuery with Ajax in WP version 5.3.2?

I am building a custom theme and using wp_enqueue_scripts to load a custom JS file for a specific page template. As you can see I declared jquery as a dependency… function enqueue_theme_scripts() { if (is_page_template(‘template-contact.php’)) { wp_enqueue_script( ‘template-contact-js’, get_bloginfo(‘template_directory’) . ‘/template-contact.js’, array(‘jquery’), false, true ); } } add_action(‘wp_enqueue_scripts’, ‘enqueue_theme_scripts’); This is what I have in […]

Categories
CMS Development Wordpress

How to load jQuery with Ajax in WP version 5.3.2?

I am building a custom theme and using wp_enqueue_scripts to load a custom JS file for a specific page template. As you can see I declared jquery as a dependency… function enqueue_theme_scripts() { if (is_page_template(‘template-contact.php’)) { wp_enqueue_script( ‘template-contact-js’, get_bloginfo(‘template_directory’) . ‘/template-contact.js’, array(‘jquery’), false, true ); } } add_action(‘wp_enqueue_scripts’, ‘enqueue_theme_scripts’); This is what I have in […]

Categories
CMS Development Wordpress

How to load jQuery with Ajax in WP version 5.3.2?

I am building a custom theme and using wp_enqueue_scripts to load a custom JS file for a specific page template. As you can see I declared jquery as a dependency… function enqueue_theme_scripts() { if (is_page_template(‘template-contact.php’)) { wp_enqueue_script( ‘template-contact-js’, get_bloginfo(‘template_directory’) . ‘/template-contact.js’, array(‘jquery’), false, true ); } } add_action(‘wp_enqueue_scripts’, ‘enqueue_theme_scripts’); This is what I have in […]

Categories
CMS Development Wordpress

Add extra parameter in

I am using this code in my plugin to enqueue script: wp_enqueue_script( ‘wpfrank-ptbw-pinit-js’, PTBW_PLUGIN_URL . ‘assets/js/pinit.js’, array(‘jquery’), ”, true ); The wp_enqueue_script function making a default <script> tag output like this: <script type=’text/javascript’ src=’http://localhost/development/wp-content/plugins/pin-it-button-pinterest-widgets/assets/js/pinit.js’></script> Want to add some extra parameter into the script tags like: <script async defer data-pin-hover=”true” src=”http://localhost/development/wp-content/plugins/pin-it-button-pinterest-widgets/assets/js/pinit.js”></script> asysnc defer data-pinhover=”true” How do […]

Categories
CMS Development Wordpress

wp-admin/admin-ajax.php 400 (Bad Request) plugin

There is a strange and frustrating behavior of the wordpress file admin-ajax.php, when I make an ajax request, it returns an incorrect 404 error request. function rp_add_header() { if (is_single() || is_page()) { // include the jquery Ajax/form validation javascript file wp_enqueue_script( ‘ajax-script’, plugin_dir_url(__FILE__).’rp-script.js’, array(‘jquery’), 1.0 ); // jQuery will be included automatically // create […]