Caroufredsel上的第一项应该是Wordpress中的当前页面项

时间:2013-03-05 21:11:04

标签: wordpress carousel caroufredsel

我在我的Wordpress主题上与Caroufredsel合作,每个项目链接到一个帖子(这个轮播总是在这篇文章的顶部。

目前,我的旋转木马是以随机顺序开始的,当前的项目怎么能有“ativo”类,是第一个开始?

这是我的js:

$("#modelos_slider_interna").carouFredSel({
    swipe       : true,
    auto        : false,
    items       : {
        height      : 175,
        width       : "variable",
        start       : "random",
    },
    prev : "#modelos_slider_interna_volta",
    next : "#modelos_slider_interna_vai",
    scroll: 1,

});

这是php:

   <div class="modelos_slider_interna">
      <div id="modelos_slider_interna">
<?php

    global $wp_query;
    $args = array( 'post_type' => 'barco', );
    $loop = new WP_Query( $args );
    $current_id = $wp_query->get_queried_object_id();
    while ( $loop->have_posts() ) : $loop->the_post();
            echo "<div class='modelos_itens_interna ". ( $current_id == $post->ID ? 'ativo' : '' ) ."'><a href='".get_permalink()."'><div class='fader'>";
            $carrosel = rwmb_meta( 'meta_barco_carrosel', 'type=plupload_image&size=');

            foreach ( $carrosel as $thumb )
               {
                  echo "<img src='".get_bloginfo('template_directory')."/inc/timthumb.php?src={$thumb['url']}&h=102&w=175' width='175' height='102' alt='{$thumb['alt']}' />";
               };

            echo "</div>";

            the_title( '<h3>', '</h3>' );

            echo"</a></div>";

    endwhile; ?>
</div>
      <div class="clearfix"></div>
      <a class="prev" id="modelos_slider_interna_volta" href="#"><span>prev</span></a> <a class="next" id="modelos_slider_interna_vai" href="#"><span>next</span></a> </div>
  </div>

1 个答案:

答案 0 :(得分:1)

根据文档http://docs.dev7studios.com/caroufredsel-old/configuration.php#items_object,只需替换以下行:

start       : "random",

TO:

start       : $("#modelos_slider_interna div.ativo"),