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.

Make parent category not selectable when it has child categories

I disabled the parent boxes to avoid shifting parents to the left. add_action( ‘admin_footer-post.php’, ‘wpse_98274_disable_top_categories_checkboxes’ ); add_action( ‘admin_footer-post-new.php’, ‘wpse_98274_disable_top_categories_checkboxes’ ); /** * Disable parent checkboxes in Post Editor. */ function wpse_98274_disable_top_categories_checkboxes() { global $post_type; if ( ‘post’ != $post_type ) return; ?> <script type=”text/javascript”> jQuery( “#category-all ul.children” ).each( function() { jQuery(this).closest( “ul” ).parent().children().children( “input” ).attr( … Read more

How to correctly add JQuery in a WP theme?

When you register/enqueue your other scripts, simply pass jQuery as the third parameter and it will be loaded first and only once, from the local WordPress files: wp_register_script( ‘theme-js’, get_template_directory_uri() . ‘/js/theme.js’, array( ‘jquery’) ); If you only need the jQuery, simply use: wp_enqueue_script(‘jquery’); You can find a list here about the javascript libraries that … Read more

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