Title: Use different slideshows on posts
Last modified: August 21, 2016

---

# Use different slideshows on posts

 *  [redbourn](https://wordpress.org/support/users/eagerwatcher/)
 * (@eagerwatcher)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/use-different-slideshows-on-posts/)
 * Well after spending hours trying out different slideshow plug-ins I found this
   one and it worked right out of the box.
 * I’m using it in a post but it would seem like I won’t be able to use a different
   slideshow in a different post.
 * Is that true? And will it always be true?
 * Thank you!
 * [http://wordpress.org/plugins/wp-cycle/](http://wordpress.org/plugins/wp-cycle/)

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

 *  Thread Starter [redbourn](https://wordpress.org/support/users/eagerwatcher/)
 * (@eagerwatcher)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/use-different-slideshows-on-posts/#post-4033570)
 * My first slide show is 335×400
 * Is there a way that I can make it left and add text on the right?
 * Thanks
 *  Thread Starter [redbourn](https://wordpress.org/support/users/eagerwatcher/)
 * (@eagerwatcher)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/use-different-slideshows-on-posts/#post-4033633)
 * [http://survivor-story.com/man-and-son-that-vanished-forty-years-ago-discovered-in-jungle](http://survivor-story.com/man-and-son-that-vanished-forty-years-ago-discovered-in-jungle)
 *  [painfreecomputing](https://wordpress.org/support/users/painfreecomputing/)
 * (@painfreecomputing)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/use-different-slideshows-on-posts/#post-4033747)
 * I’m just another user, but it’s clear that this is not a feature of wp-cycle.
   I was just about to suggest this as a future enhancement. The author’s FAQ lists
   the following “future plans”, but does not list the ability to use multiple instances.
    - Add ability to reorder the images
    - Add new effects to the slideshow
    - Add the ability to override settings by using function arguments: <?php wp_cycle(‘
      rotate=1&effect=fade&img_width=300&img_height=200&div=slideshow’); ?>
    - Possibly add widget support so that you can put a slideshow in a widget area
 * Jack
 *  [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * (@gyan-gaurav)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/use-different-slideshows-on-posts/#post-4033805)
 * Hi eagerwatcher !!
 * I have done the same thing what you wanted.. but it required me a bit of modification
   in the plugin code..I can do this for you if you want..
 *  [jswanagon](https://wordpress.org/support/users/jswanagon/)
 * (@jswanagon)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/use-different-slideshows-on-posts/#post-4033863)
 * Has anybody figured this out yet? I really need to be able to create multiple
   slideshows on one site. I tried SEO image rotate, but it doesn’t work in IE and
   for some reason it kept resizing my images and then cropping them.
 * Gyan, I would love to hear what you did, but I cannot find any contact info for
   you.
 * Thank you in advance.
 *  [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * (@gyan-gaurav)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/use-different-slideshows-on-posts/#post-4033864)
 * Hi jswanagon,
 * >  I tried SEO image rotate, but it doesn’t work in IE and for some reason it
   > kept resizing my images and then cropping them.
 * do you want to include different slides that too of different dimensions ?
    if
   yes. i am sorry my script is no more helpful. wp_cycle adds global dimension 
   and slider effect to all slides that we make.
 * however I am posting my solution here for you (let me arrange it) . but it will
   not handle the dimension issue.
 *  [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * (@gyan-gaurav)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/use-different-slideshows-on-posts/#post-4033866)
 * this one is going to be quite long but its very much similar as [http://wordpress.org/support/topic/image-re-order?replies=9](http://wordpress.org/support/topic/image-re-order?replies=9)
   this one.
 * we will start it by adding one field namely “img-category” in the image data..
   find this code in wp-cycle.php in the plugin directory..
 *     ```
       $wp_cycle_images[$time] = array(
               'id' => $time,
               'file' => $file,
               'file_url' => $url,
               'thumbnail' => $thumbnail,
               'thumbnail_url' => $thumbnail_url,
               'image_links_to' => ''
           );
       ```
   
 * and add here another line ‘img-category’ => ” so that it become like ..
 *     ```
       $wp_cycle_images[$time] = array(
               'id' => $time,
               'file' => $file,
               'file_url' => $url,
               'thumbnail' => $thumbnail,
               'thumbnail_url' => $thumbnail_url,
               'image_links_to' => '',
               'img_category' => ''
           );
       ```
   
 * then we need to make it appear in the admin section .. so find the <thead> and
   <tfoot> section here..
    and in the <tr> section of both of these <thead> and 
   <tfoot> add a line <th scope=”col”>Image category</th> this will make it appear
   in the settings page. Just below that </tbody> section you will find a form like
   <form method=”post” action=”options.php”> now in this form add a <td> like
 * `<td><input type="text" name="wp_cycle_images[<?php echo $image; ?>][img_category]"
   value="<?php echo $data['img_category']; ?>" size="35" /></td>`
 * this .
 * Next we need to store this category data . therefore find a function there function
   wp_cycle_images_validate($input) {
    add this code below the last line of the 
   function.
 *     ```
       if($value['img_category'])
       $input[$key]['img_category'] = wp_filter_nohtml_kses($value['img_category']);
       ```
   
 * when all above done now we need to make a function that will call the slides 
   by category.
    add the following function below the wp_cycle function.
 *     ```
       function wp_cycle_category($args = array(), $content = null) {
   
           global $wp_cycle_settings, $wp_cycle_images, $wp_cycle_category;
   
           $args = wp_parse_args($args, $wp_cycle_settings);
   
           $newline = "\n"; // line break
   
           echo '<div id="'.$wp_cycle_category.'" style="margin-left:15px;">'.$newline;
   
           foreach((array)$wp_cycle_images as $image => $data) {
   
               if($data['image_category'] == $wp_cycle_category){
   
               echo '<div>';
               if($data['image_links_to'])
                   echo '<a target="_blank" href="'.$data['image_links_to'].'" >';
                   echo '<img src="'.$data['file_url'].'" width="'.$wp_cycle_settings['img_width'].'" height="'.$wp_cycle_settings['img_height'].'" class="'.$data['id'].'" alt="'. $data['image_category'] .'" />';
               if($data['image_links_to'])
                   echo '</a>';
               echo '</div>';
               }
           }
           echo '</div>'.$newline;
           ?>
   
           <script type="text/javascript">
           jQuery(document).ready(function($) {
           $("#<?php echo $wp_cycle_category; ?>").cycle({
               fx: '<?php echo $wp_cycle_settings['effect']; ?>',
               timeout: <?php echo ($wp_cycle_settings['delay'] * 1000); ?>,
               speed: <?php echo ($wp_cycle_settings['duration'] * 1000); ?>,
               random: <?php echo $wp_cycle_settings['random']; ?>,
               pause: 0,
               fit: 1,
              after: function() {
   
                 }
           });
   
       });
       </script>
       <?php
       }
       ```
   
 * we are all set now. just make the short code . find the following code the bottom.
 *     ```
       add_shortcode('wp_cycle', 'wp_cycle_shortcode');
       function wp_cycle_shortcode($atts) {
   
       	// Temp solution, output buffer the echo function.
       	ob_start();
       	wp_cycle();
       	$output = ob_get_clean();
   
       	return $output;
   
       }
       ```
   
 * below this add following lines.
 *     ```
       add_shortcode('wp_cycle_category','wp_cycle_category_shortcode');
       function wp_cycle_category_shortcode($atts) {
   
       global $wp_cycle_category;
       $atts = shortcode_atts(
       array(
           'category' => ''
       ), $atts);   
   
       $wp_cycle_category = $atts['category'];
   
           ob_start();
           wp_cycle_category();
           $output = ob_get_clean();
   
           return $output;
       }
       ```
   
 * now you should be able to add slides depending on the categories. to set categories
   to image slides. open wp_cycle admin section. you will find a category field.
   add categories , save it.
    and call it on pages by this short code [wp_cycle_category
   category=”your-category-name”]

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

The topic ‘Use different slideshows on posts’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-cycle.svg)
 * [WP-Cycle](https://wordpress.org/plugins/wp-cycle/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-cycle/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-cycle/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-cycle/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-cycle/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-cycle/reviews/)

 * 7 replies
 * 4 participants
 * Last reply from: [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/use-different-slideshows-on-posts/#post-4033866)
 * Status: not resolved