Getting click on item to open closest relevant element (popup) with jQuery

You are facing this issue because all your popup container divisions have the same id and all the popup open can close buttons are targeting the same id. Change your code as follow: <td> <h4>Alert #1</h4> <a href=”#” class=”open-alert-popup” data-id=”popup_alerts_1″ data-animation=”flipAlertsRight”>Open Button</a> <!- below div is hidden till above link is clicked -> <div id=”popup_alerts_1″ … Read more

Theme customisation – how to store javascript externally when it utilises php variables?

Since it’s a plugin, you should enqueue jQuery first. Inside your add_action(‘wp_head’, function () { before wp_register_script( ‘custom_script’, get_stylesheet_directory_uri() . ‘/custom.js’ ); add : if ( ! wp_script_is( ‘jquery’, ‘enqueued’ )) { //Enqueue jQuery wp_enqueue_script( ‘jquery’ ); } This will check if jQuery is loaded and if not it will load it. Then, in your … Read more

Add JQuery As Code Snippet

Create js file and add it to your child theme script folder. Then just add code to functions.php, example if page is checout wp_enqueue that file. Example: https://sridharkatakam.com/how-to-load-woocommerce-css-and-js-only-on-shop-specific-pages-in-wordpress/

jQuery Validation plugin and Bootstrap 4 CSS classes

I found this solution: $.validator.setDefaults({ highlight: function (element, errorClass, validClass) { $(element).addClass(‘is-invalid’); }, unhighlight: function (element, errorClass, validClass) { $(element).removeClass(‘is-invalid’); } }); This is my previous personal solution: signup_form.on( ‘change submit’, function( e ) { $( ‘.error’ ).removeClass( ‘is-valid’ ).addClass( ‘is-invalid’ ); $( ‘.valid’ ).removeClass( ‘is-invalid’ ).addClass( ‘is-valid’ ); } ); Which is better?

WordPress Slick Slider + Magnific Popup

Yes, it is possible to get original image and a smaller version of it. Use wp_get_attachment_url($id) to get the full url and wp_get_attachment_image_src($id,$size) for the smaller version. EDIT: You can get the name of the original uncropped (full) image from the attachments post_meta. Then replace the cropped file name with the original name in the … Read more

Access html element in media modal with jQuery

(function($){ //since only one label with data-setting=’caption’ exists, use this selector $(“[data-setting=caption]”).children(‘textarea’).attr(‘required’, true); })(jQuery); I’m more curious as to how adding this would affect anything since these labels are not inside a <form> element?