Use WordPress Built In Jquery

The jQuery object is jQuery rather than $. See noConflict wrappers in wp_enqueue_script for some examples. jQuery(document).ready(function($) { // Inside of this function, $() will work as an alias for jQuery() // and other libraries also using $ will not be accessible under this shortcut });

Add a class to a menu item depending on a body class

Use the nav_menu_css_class() filter. The following function will add the current-menu-item class to a page identified by it’s slug. You can Update the $cpt_name and $menu_item_id variables to reflect your setup. add_filter( ‘nav_menu_css_class’, ‘nav_parent_class’, 10, 2 ); function nav_parent_class( $classes, $item ) { $cpt_name=”team”; $menu_item_id = 127; // id of menu item to add current-menu-item … Read more

Use ajax response in PHP function

Instead of cooking up your own PHP file and trying to bring in WordPress functionality, put the functionality inside of WordPress using the AJAX hooks that are designed to do that sort of thing. More info here: http://codex.wordpress.org/AJAX_in_Plugins

What is calling jquery?

If I am correct, those two js files are “only” loaded by WP itself for use in the back-end(Admin), but not (and WP would not load them if no need for it) in the front-end. As soon a plugin needs them, they will be loaded (e.g. through a function) in the front-end. (which seems not … Read more

Does anyone know how to load jquery in the footer?

Use the 5th parameter when using the wp_enqueue_script function: Normally, scripts are placed in <head> of the HTML document. If this parameter is true, the script is placed before the end tag. This requires the theme to have the wp_footer() template tag in the appropriate place. Default: false

Jquery in IE, fully messed up

After a long debugging, I found that the class .nivoSlider was not having a definite height, so I gave a height height:288px !important; and woila, it worked,

jQuery cycle thumbnails?

I use the jQuery cycle on the home page of http://getwellgabby.org/. You can inspect the elements to see what’s going on with CSS here. For the PHP, I wrote a custom home page template as part of a child theme based on TwentyTen. There are two loops in the page: One that gets the static … Read more

Carousel Hover Image

I figured it out!! I added this piece of jQuery: <script type=”text/javascript”> <!– $(function() { jQuery(“.photos a”).hover(function() { var offset = $(this).offset(); var id_post = $(this).attr(“id”); jQuery(“.hover”).find(“span[id=”+id_post+”]”).css(“left”, (offset.left-312)+”px”); jQuery(“.hover”).find(“span[id=”+id_post+”]”).show(); }, function() { jQuery(“.hover”).find(“span”).hide(); }) }); //–> </script> and added an additional loop: <div class=”hover”> <?php query_posts( ‘category_name=photos&posts_per_page=-1’ ); ?> <?php if ( have_posts() ) : … Read more