图像滑块 - 如何更改图像的顺序

时间:2013-06-23 18:24:04

标签: php jquery wordpress slider

我在Wordpress主题中使用全屏背景图像滑块。

现在的问题是我无法控制图像的加载顺序。当我删除图像并再次上传(通过wordpress)时,顺序是不同的。当我一次上传所有内容时,它会按字母顺序排序。当我逐个上传它们时,顺序是随机的。

正如您在下面的滑块设置中所见 - 随机已禁用

以下是控制滑块的脚本:

<script type="text/javascript">
jQuery(function($){
    jQuery.supersized({

        // Functionality
        slideshow               :   1,          // Slideshow on/off
        autoplay                :   1,          // Slideshow starts playing automatically
        start_slide             :   1,          // Start slide (0 is random)
        image_path              :   '<?php echo get_template_directory_uri(); ?>/images/supersized/',
        stop_loop               :   <?php echo $slideshow_pause_on_last; ?>,            // Pauses slideshow on last slide
        random                  :   0,          // Randomize slide order (Ignores start slide)
        slide_interval          :   <?php echo $slideshow_interval; ?>,     // Length between transitions
        transition              :   <?php echo $slideshow_transition; ?>,           // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
        transition_speed        :   <?php echo $slideshow_transition_speed; ?>,     // Speed of transition
        new_window              :   0,          // Image links open in new window/tab
        pause_hover             :   <?php echo $slideshow_pause_hover; ?>,          // Pause slideshow on hover
        keyboard_nav            :   1,          // Keyboard navigation on/off
        performance             :   2,          // 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
        image_protect           :   1,          // Disables image dragging and right click with Javascript

        // Size & Position                         
        min_width               :   0,          // Min width allowed (in pixels)
        min_height              :   0,          // Min height allowed (in pixels)
        vertical_center         :   <?php echo $slideshow_vertical_center; ?>,          // Vertically center background
        horizontal_center       :   <?php echo $slideshow_horizontal_center; ?>,            // Horizontally center background
        fit_always              :   <?php echo $slideshow_fit_always; ?>,           // Image will never exceed browser width or height (Ignores min. dimensions)
        fit_portrait            :   <?php echo $slideshow_portrait; ?>,         // Portrait images will not exceed browser height
        fit_landscape           :   <?php echo $slideshow_landscape; ?>,            // Landscape images will not exceed browser width

        // Components                           
        slide_links             :   'blank',    // Individual links for each slide (Options: false, 'number', 'name', 'blank')
        thumb_links             :   1,          // Individual thumb links for each slide
        thumbnail_navigation    :   0,          // Thumbnail navigation
        slides                  :   [           // Slideshow Images


<?php 
// Don't Populate list if no Featured page is set
$bg_slideshow = of_get_option ('general_bgslideshow');

if ($bg_choice=="Image Attachments Slideshow") { $bg_slideshow = $post->ID; }
if ($bg_choice=="Fullscreen Post Slideshow" ) { $bg_slideshow = $fullscreen_slideshowpost; }

if ( $bg_slideshow <>"" ) {

    // Grab all image attachements from the featured page
    $images =& get_children( array( 
                                'post_parent' => $bg_slideshow,
                                'post_status' => 'inherit',
                                'post_type' => 'attachment',
                                'post_mime_type' => 'image',
                                'order' => 'ASC',
                                'numberposts' => $thelimit,
                                'orderby' => 'menu_order' )
                                );

    // Loop through the images
    foreach ( $images as $id => $image ) {
        $attatchmentID = $image->ID;
        $imagearray = wp_get_attachment_image_src( $attatchmentID , 'full', false);
        $imageURI = $imagearray[0];
        $imageID = get_post($attatchmentID);
        $imageTitle = apply_filters('the_title',$image->post_title);
        $imageDesc = apply_filters('the_title',$image->post_content);
        $postlink = get_permalink($image->post_parent);
        // If linking is On
        if ($featured_linked == 1 || $featured_linked == true) {
            $attatchmentURL = get_attachment_link($image->ID);
        }
        // Count
        $count++;
        if ($count>1) { echo ","; }

        $slideshow_title="";
        $slideshow_caption="";

        if ($imageTitle) $slideshow_title='<div class="slideshow_title">'.$imageTitle.'</div>';
        if ($imageDesc) $slideshow_caption='<div class="slideshow_caption">'.$imageDesc.'</div>';

        echo "{image : '".$imageURI."', title : '". $slideshow_title . $slideshow_caption . "', url : ''}";
    }

// If Ends here for the Featured Page
}
?>
        ],
        progress_bar            :   1,          // Timer for each slide                         
        mouse_scrub             :   1
    });
});
</script> 

我希望对订单有一些控制 - 除了随机之外的任何东西。我该怎么做/我在剧本中有什么变化?

使用滑块的主题 - http://www.imaginemthemes.com/themes/?theme=RSW

谢谢!

0 个答案:

没有答案