Skip to main content
Añadir código funcional editado para los círculos de desplazamiento dinamizados.
Origen Enlace
Dianne
  • 457
  • 4
  • 18

Vale, ya arreglé el problema. Al parecer el href estaba haciendo interferencias con mi scroll, por lo que solo debía de cambiar el href por data-target . El código completo y funcional queda así:

<?php $diapositivesloop$diapositivesloop2 =$diapositivesloop = new WP_Query( array( 'post_type' => 'slider', 'posts_per_page' => -1 ) ); ?>
    <?php $i=1;$i=1;$v=0 ?>
<div id="carousel-example-generic" class="carousel slide carousel-fade center-block" data-ride="carousel">
        <!-- Indicators -->
         <ol class="carousel-indicators">
            <li
<?php data-target="#carousel-example-generic"while data( $diapositivesloop2-slide>have_posts() ) : $diapositivesloop2-to="0">the_post(); class="active"></li>?>
            <li data-target="#carousel-example-generic" data-slide-to="1"></li>
to="<?php echo $v;?>"
<?php if($v==0){echo "class='active'";} ?>"></li><?php $v++; ?>
    <?php <liendwhile; data-target="#carousel-example-generic"wp_reset_query(); data-slide-to="2"></li>
?>
    <li data-target="#carousel-example-generic" data-slide-to="3"></li>
   </ol>     </ol>

        <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
    <?php while ( $diapositivesloop->have_posts() ) : $diapositivesloop->the_post(); ?> 

            <div class="item <?php if ($i == 1) echo 'active'; ?>">
                <img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>" alt="centroSlider"> 

                <div class="carousel-caption">
                    <a href="<?php the_permalink() ?>"></a>
                </div>
            </div>

    <!-- End of the loop -->
    <?php $i++; ?>
    <?php endwhile; wp_reset_query(); 
?>

 
<!-- Controls -->
<a class="left carousel-control" data-target="#carousel-example-generic" data-slide="prev">
<span class="sr-only">Previous</span>‹</a>
 <a class="right carousel-control" data-target="#carousel-example-generic" data-slide="next"><span class="sr-only">Previous</span>›</a>
    </div>
</div>

Vale, ya arreglé el problema. Al parecer el href estaba haciendo interferencias con mi scroll, por lo que solo debía de cambiar el href por data-target . El código completo y funcional queda así:

<?php $diapositivesloop = new WP_Query( array( 'post_type' => 'slider', 'posts_per_page' => -1 ) ); ?>
    <?php $i=1; ?>
<div id="carousel-example-generic" class="carousel slide carousel-fade center-block" data-ride="carousel">
        <!-- Indicators -->
        <ol class="carousel-indicators">
            <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
            <li data-target="#carousel-example-generic" data-slide-to="1"></li>
            <li data-target="#carousel-example-generic" data-slide-to="2"></li>
    <li data-target="#carousel-example-generic" data-slide-to="3"></li>
        </ol>

        <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
    <?php while ( $diapositivesloop->have_posts() ) : $diapositivesloop->the_post(); ?>
            <div class="item <?php if ($i == 1) echo 'active'; ?>">
                <img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>" alt="centroSlider">
                <div class="carousel-caption">
                    <a href="<?php the_permalink() ?>"></a>
                </div>
            </div>

    <!-- End of the loop -->
    <?php $i++; ?>
    <?php endwhile; wp_reset_query(); 
?>

 
<!-- Controls -->
<a class="left carousel-control" data-target="#carousel-example-generic" data-slide="prev">
<span class="sr-only">Previous</span>‹</a>
 <a class="right carousel-control" data-target="#carousel-example-generic" data-slide="next"><span class="sr-only">Previous</span>›</a>
    </div>
</div>

Vale, ya arreglé el problema. Al parecer el href estaba haciendo interferencias con mi scroll, por lo que solo debía de cambiar el href por data-target . El código completo y funcional queda así:

<?php $diapositivesloop2 =$diapositivesloop = new WP_Query( array( 'post_type' => 'slider', 'posts_per_page' => -1 ) ); ?>
    <?php $i=1;$v=0 ?>
<div id="carousel-example-generic" class="carousel slide carousel-fade center-block" data-ride="carousel">
        <!-- Indicators -->
         <ol class="carousel-indicators">
            
<?php while ( $diapositivesloop2->have_posts() ) : $diapositivesloop2->the_post(); ?>
            <li data-target="#carousel-example-generic" data-slide-to="<?php echo $v;?>"
<?php if($v==0){echo "class='active'";} ?>"></li><?php $v++; ?>
    <?php endwhile; wp_reset_query(); 
?>
        </ol>     

        <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
    <?php while ( $diapositivesloop->have_posts() ) : $diapositivesloop->the_post(); ?> 

            <div class="item <?php if ($i == 1) echo 'active'; ?>">
                <img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>" alt="centroSlider"> 

                <div class="carousel-caption">
              
                </div>
            </div>

    <!-- End of the loop -->
    <?php $i++; ?>
    <?php endwhile; wp_reset_query(); 
?>
<!-- Controls -->
<a class="left carousel-control" data-target="#carousel-example-generic" data-slide="prev">
<span class="sr-only">Previous</span>‹</a>
 <a class="right carousel-control" data-target="#carousel-example-generic" data-slide="next"><span class="sr-only">Previous</span>›</a>
    </div>
</div>
Origen Enlace
Dianne
  • 457
  • 4
  • 18

Vale, ya arreglé el problema. Al parecer el href estaba haciendo interferencias con mi scroll, por lo que solo debía de cambiar el href por data-target . El código completo y funcional queda así:

<?php $diapositivesloop = new WP_Query( array( 'post_type' => 'slider', 'posts_per_page' => -1 ) ); ?>
    <?php $i=1; ?>
<div id="carousel-example-generic" class="carousel slide carousel-fade center-block" data-ride="carousel">
        <!-- Indicators -->
        <ol class="carousel-indicators">
            <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
            <li data-target="#carousel-example-generic" data-slide-to="1"></li>
            <li data-target="#carousel-example-generic" data-slide-to="2"></li>
    <li data-target="#carousel-example-generic" data-slide-to="3"></li>
        </ol>

        <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
    <?php while ( $diapositivesloop->have_posts() ) : $diapositivesloop->the_post(); ?>
            <div class="item <?php if ($i == 1) echo 'active'; ?>">
                <img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>" alt="centroSlider">
                <div class="carousel-caption">
                    <a href="<?php the_permalink() ?>"></a>
                </div>
            </div>

    <!-- End of the loop -->
    <?php $i++; ?>
    <?php endwhile; wp_reset_query(); 
?>


<!-- Controls -->
<a class="left carousel-control" data-target="#carousel-example-generic" data-slide="prev">
<span class="sr-only">Previous</span>‹</a>
 <a class="right carousel-control" data-target="#carousel-example-generic" data-slide="next"><span class="sr-only">Previous</span>›</a>
    </div>
</div>