I would like to modify a WP Gallery to use the jquery cycle plugin by malsup. I know this is possible but would like to know best practice for this, if anything just pulling out the url for each image should give me enough to work with. Please advise on best practice for this. Note I do not want to use a plugin and would like to build this site on WP Core.

  • Someone has already integrated this with the NextGen Gallery and JJ NextGen JQuery Cycle – NW Tech May 24 '11 at 20:21
  • I meant that I do not want to use a WP plugin. I want to cycle through the images in the WP Gallery tag feature and wrap those images in jQuery cycle. – jnolte May 24 '11 at 20:52

What your asking for has the basic functionality of a plugin, so saying you don't want to use a plugin doesn't make much sense.

If you do for some reason want to write your own , using any jquery or JavaScript is relatively straightforward, you enqueue the script where you want it, then wrap whatever data your using in the javascript tags ( usually a div class or id ). This is a very basic example. http://codex.wordpress.org/Function_Reference/wp_enqueue_script

 wp_register_script( 'jquery_cycle_name','http://path-to-your-cycle.js');
 wp_enqueue_script( 'jquery_cycle_name' );

The javascript:

jQuery(document).ready(function($) {

Your template or whatever you wrap your info in, typically you want this in a loop to go through several images/posts or content.

<div class="featured-work"> images, etc, go here</div>
  • Thank you for your reply Wyck, My meaning plugin meant I did not want to rely on a WP plugin, I would like to accomplish this by using WordPress' built in WP Gallery. I am a front-end developer who spends some time in WordPress but not that often, so making the JS work is not an issue. I would like the client to be able to edit the cycle on the respective page by just editing the gallery within that page. – jnolte May 24 '11 at 20:54
  • Use the example above, to loop through a posts images you can wrap the javascript div with something like get_children, codex.wordpress.org/Function_Reference/get_children – Wyck May 24 '11 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.