Title: Using Jquery within a post
Last modified: August 20, 2016

---

# Using Jquery within a post

 *  [dithmo](https://wordpress.org/support/users/dithmo/)
 * (@dithmo)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/using-jquery-within-a-post/)
 * Hi folks, sorry if this is in the wrong section but it seemed to be the place
   to put it.
 * Im currently trying to use a jquery crossfade called cycle and I have also used
   another simple jquery crossfade however, with both pieces of code, instead of
   crossfading the images it fades out to black then the next image fades in. I 
   have been trying to eliminate possibilties and I dont think that it is the jquery.
 * I have used both the crossfaders on static html and they worked fine. I cant 
   see anything wrong in my css either so I was wondering if it could be a conflict
   with the way wordpress works. Has anyone else come across something like this?
 * here is the code in the head of my template:
 * <script src=”[http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js”></script&gt](http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js”></script&gt);
   
   <script src=”/wp-content/themes/IOL/js/jquery.cycle.all.js”></script>
 * <script>
    $(document).ready(function() { $(‘.anim’).cycle({ fx: ‘fade’, }); });
   </script>
 * and this is the code in the actual post:
 * <div class=”anim”>
    <img style=”” src=”/wp-content/uploads/2012/11/Homepage-sidebar-
   001.jpg” alt=”” width=”960px” /> <img style=”” src=”/wp-content/uploads/2012/
   11/Homepage-sidebar-002.jpg” alt=”” width=”960px” /> </div>
 * If anyone can offer any help it would be greatly appreciated
 * P.S Interestingly, when it reaches the end of the images it crossfades perfectly
   back to the begining!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * (@andrew-bartel)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/using-jquery-within-a-post/#post-3248964)
 * First, any reason why you’re using 1.5?
 * Second, WordPress is pretty picky about how you include your javascript. Review
   [wp_enqueue_script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script)
   and let us know if you have any questions. Here’s an example of what you’d put
   in your functions.php file:
 *     ```
       add_action('wp_enqueue_scripts','include_my_javascript');
   
       function include_my_javascript() {
       wp_enqueue_script('jquery.cycle.js','path/to/js');
       }
       ```
   
 *  Thread Starter [dithmo](https://wordpress.org/support/users/dithmo/)
 * (@dithmo)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/using-jquery-within-a-post/#post-3248967)
 * Hi Andrew, thanks for your fast reply. Firstly Im not actually using 1.5, I downgraded
   a minute ago just incase it was a version difference. the example page of the
   cycle plugin used 1.5 so I thought id check, but nice catch 🙂
 * Secondly I have been using a plugin called add to head and just including the
   javascript as posted above however I will try adding that to the functions.php
   and see if that works.
 * Thanks very much for your help
 *  [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * (@andrew-bartel)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/using-jquery-within-a-post/#post-3248968)
 * Honestly just going by WordPress “best practices” has solved 90% of the frustration
   that I originally encountered when I started developing in WP.
 * In general I shy away from using “$” when using jQuery in WordPress (just use“
   jQuery”) instead. There are some tricks to get it to work but I’ve never gotten
   around to really mastering them.
 *  Thread Starter [dithmo](https://wordpress.org/support/users/dithmo/)
 * (@dithmo)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/using-jquery-within-a-post/#post-3248971)
 * Good to know mate, im only just getting started with jquery so i didnt know the“
   $” issue but i suppose theres always more to learn isnt there 🙂
 *  [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * (@andrew-bartel)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/using-jquery-within-a-post/#post-3248973)
 * Oh ya, wait till you hit the custom post types and custom taxonomies.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Using Jquery within a post’ is closed to new replies.

## Tags

 * [crossfade](https://wordpress.org/support/topic-tag/crossfade/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/using-jquery-within-a-post/#post-3248973)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
