How do I pass WordPress’s get_bloginfo(‘siteurl’) to Jquery?

Use wp_localize_script() to pass variables to the front end so that you can pick them by javascript. Use it like this: wp_enqueue_script( ‘some_handle’ ); $data = array( ‘some_string’ => __( ‘Some string to translate’ ) ); wp_localize_script( ‘some_handle’, ‘object_name’, $data ); And pick it up like object_name.some_string in javascript code.

What do I need jQuery for?

jQuery is loaded by the theme that you use and not by WordPress. The theme must be modified to not load jQuery. Useless? not sure. It is very useful. Many themes’ UI elements and even design elements may depend on jQuery.

WordPress Jquery Fade in, Fade out effect

Going through your source – jQuery Source – it seeems that noConflict() is getting called right at the end. To fix your hover.js then would look something like this: jQuery(function($) { //Allow the use of $ namespace in this function. // OPACITY OF BUTTON SET TO 50% $(“.imgopacity”).css(“opacity”,”0.5″); // ON MOUSE OVER $(“.imgopacity”).hover(function () { … Read more

wp_enqueue_scripts hook is not being called

Your code is correct, though I would not add the callback if the function name has already been used. If someone else has used the name you don’t know what you might be adding. if(!function_exists(‘bi_frontend_scripts’)) { function bi_frontend_scripts() { wp_enqueue_script(‘jquery’); // I originally wanted to do: wp_enqueue_script(‘jQuery.bxSlider’, get_bloginfo(‘template_url’).’/scripts/jquery.bxslider/jquery.bxslider.min.js’, array(‘jquery’)); } add_action(‘wp_enqueue_scripts’, ‘bi_frontend_scripts’); } I also … Read more

how can I make $ work in wordpress for jQuery?

Try this: jQuery(function ($) { /* You can safely use $ in this code block to reference jQuery Call your plugin here */ }) I think you already know this. But still for reference http://api.jquery.com/jQuery.noConflict/

What are best practices for including jquery plugins

Why you shouldn’t hardcode javascript files There are several reasons why you shouldn’t hardcode links to javascript files: It sidesteps WordPress’ queuing of javascript files which is designed to handle dependencies for you. Plug-ins exist which force scripts to be loaded in the footer (hard-coding would mean they couldn’t do this, and may even break … Read more

wp_mail very slow

What am i doing wrong here? Many, many things, not all performance related. Lets begin with the critical parts, then conclude on your performance issues and what can be done to mitigate and help AJAX API Firstly, you’re not using the AJAX API, and reinventing the wheel. It’s quite simple: JS: $.post( do_mail_sending.ajaxurl, { action: … Read more

wp_ajax() question.. not using wp_enqueue_script?

Ok, firstly let me just break it down a little, so you understand the purpose of these functions. wp_enqueue_script() Description: A safe way of adding javascripts to a WordPress generated page. Basically, include the script if it hasn’t already been included, and load the one that WordPress ships. wp_localize_script() Description: Localizes a script, but only … Read more

How do I setup nested repeatable option fields?

Not a direct answer to your specific case but this will probably help you figure out how to do it. I found an article here: http://www.sutanaryan.com/jquery-duplicate-fields-form-submit-with-php/ which details the process of posting fields which can be repeated using jQuery. In his example he creates an HTML form: <form action=”process.php” method=”post”> <p class=”clone”> <label> Name: </label> … Read more