WooCommerce single product edit flexslider settings

After a little digging through the source I found there is a filter called woocommerce_single_product_carousel_options that can be used to modify the flex slider options for example: function my_product_carousel_options($options) { $options[‘animation’] = ‘fade’; return $options; } add_filter(“woocommerce_single_product_carousel_options”, “my_product_carousel_options”, 10);

Using Underscore Templates in WordPress

Your plugin index file: add_action( ‘print_media_templates’, ‘wpse8170_admin_footer’ ); function wpse8170_admin_footer() { require ‘templates.php’; } Your templates.php: <script id=”tmpl-mytemplate” type=”text/html”> <h1>Hello {{data.name}}!</h1> </script> Your media js file: wp.media.view.MyView = wp.media.View.extend({ template: wp.media.template(‘mytemplate’), render: function() { this.$el.html(this.template({name: ‘world’})); } });

Using ‘$’ instead of ‘jQuery’ in WordPress

Using a self invoking anonymous function that passes the jQuery object will do the trick: (function($){ $(window).load(function(){ $(‘#myid’).css({‘background’: ‘black’, ‘color’:’white’}); }); })(jQuery); //Passing the jQuery object as a first argument

Loading style.css and Jquery using HTTPS

Since you are behind a load balancer (confirmed in your comments above), your WordPress installation won’t be able to detect SSL using the is_ssl() function, and will not serve any enqueued scripts or stylesheets with https: protocol URIs. If you are behind a load balancer that supports the HTTP_X_FORWARDED_PROTO server variable, you can fix your … Read more

How to handle multiple instance of “send_to_editor” js function

only overwrite the send_to_editor function when your link or button is click but store the old function to restore it so try this on a click event: //store old send to editor function window.restore_send_to_editor = window.send_to_editor; //overwrite send to editor function window.send_to_editor = function(html) { var imgurl = jQuery(‘img’,html).attr(‘src’); current_item.siblings(‘.upload_image’).val(imgurl); current_item.parent().prepend(‘<div><img width=”300″ src=”‘+imgurl+'” alt=”banner image” … Read more

Ajax call does not activate callback function

Since you’re serializing the form, as ajax data, you could be missing the action part from your form: <input type=”hidden” name=”action” value=”bda_alert”> so your ajax request would contain /wp-admin/admin-ajax.php?action=bda_alert&… that should invoke the wp_ajax_bda_alert or wp_ajax_nopriv_bda_alert action callback.

wp_mail script with jQuery post

Basically, you can use JavaScript to post to a WordPress function, then the WordPress function can invoke wp_mail() to send the message. A great place to start would be the useful AJAX in Plugins article on the Codex. It walks you through all the steps required to add your JavaScript on the front-end, your PHP … Read more

Check if jquery library exist

scripts and styles should never be embedded directly in themes or templates because of potential conflicts between plugins and themes. To use jQuery in a plugin or theme it should be enqueued with wp enqueue script. This will make sure it’s added only once, and any scripts that define it as a dependency will load … Read more