WordPress.org

Ready to get started?Download WordPress

Forums

WP-Cycle
Use different slideshows on posts (8 posts)

  1. eagerwatcher
    Member
    Posted 8 months ago #

    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/

  2. eagerwatcher
    Member
    Posted 8 months ago #

    My first slide show is 335x400

    Is there a way that I can make it left and add text on the right?

    Thanks

  3. eagerwatcher
    Member
    Posted 8 months ago #

  4. painfreecomputing
    Member
    Posted 8 months ago #

    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

  5. Gyan Gaurav
    Member
    Posted 7 months ago #

    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..

  6. jswanagon
    Member
    Posted 5 months ago #

    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.

  7. Gyan Gaurav
    Member
    Posted 5 months ago #

    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.

  8. Gyan Gaurav
    Member
    Posted 5 months ago #

    this one is going to be quite long but its very much similar as 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"]

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.