Skip to content

Commit

Permalink
+ [Lib] Upgrade
Browse files Browse the repository at this point in the history
• Bootstrap upgrade
• FontAwesome Upgrade
• Functions - some fixes
  • Loading branch information
xwazzo committed Sep 9, 2014
1 parent 47bde13 commit bc101ee
Show file tree
Hide file tree
Showing 330 changed files with 15,182 additions and 32,413 deletions.
147 changes: 75 additions & 72 deletions carousel.php
Original file line number Diff line number Diff line change
@@ -1,89 +1,92 @@
<?php $args_carousel = array(
'category_name' => 'carousel',
'posts_per_page' => 4
'posts_per_page' => 4,
'orderby' => 'menu_order',
'order' => 'ASC'
); ?>


<?php $carousel_query = new WP_Query( $args_carousel ); ?>
<?php $sizeof_query = sizeof($carousel_query->posts); ?>

<?php if( $carousel_query->have_posts() ): ?>

<div id="main-carousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">

<?php $i=0; ?>

<?php while( $carousel_query->have_posts() ) : $carousel_query->the_post(); ?>
<?php if( $i==0 ): ?>
<li data-target="#main-carousel" data-slide-to="<?php echo $i; ?>" class="active"></li>
<?php else: ?>
<li data-target="#main-carousel" data-slide-to="<?php echo $i; ?>"></li>
<?php endif; ?>
<?php $i++; endwhile; ?>

</ol>

<div class="carousel-inner">
<?php $i=0; ?>
<?php while( $carousel_query->have_posts() ) : $carousel_query->the_post(); ?>
<?php $thumb_img_src = wp_get_attachment_image_src( get_post_thumbnail_id(), 'slide-1920-460'); ?>
<?php $thumb_url_src = $thumb_img_src[0]; ?>

<?php if( $i==0 ): ?>
<div class="item active">

<?php if( has_post_thumbnail() ): ?>
<style type="text/css">
.carousel-slide-<?php echo $i; ?>{ background-image: url(<?php echo $thumb_url_src; ?>); }
</style>

<div class="carousel-slide-<?php echo $i; ?>"></div>
<?php endif; ?>

<?php if( get_the_content() ): ?>
<div class="carousel-caption">
<?php the_content(); ?>

<a class="primary-btn" href="<?php the_permalink(); ?>">Ver Más »</a>
</div><!-- end .carousel-caption -->
<?php endif; ?>

</div><!-- end .item -->
<?php else: ?>
<div class="item">

<?php if( has_post_thumbnail() ): ?>
<style type="text/css">
.carousel-slide-<?php echo $i; ?>{ background-image: url(<?php echo $thumb_url_src; ?>); }
</style>

<div class="carousel-slide-<?php echo $i; ?>"></div>
<?php endif; ?>

<?php if( get_the_content() ): ?>
<div class="carousel-caption">
<?php the_content(); ?>

<a class="primary-btn" href="<?php the_permalink(); ?>">Ver Más »</a>
</div><!-- end .carousel-caption -->
<?php endif; ?>

</div><!-- end .item -->
<?php endif; ?>
<?php $i++; endwhile; ?>
</div><!-- end .carousel-inner -->

<!-- Controls -->
<a class="left carousel-control" href="#main-carousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#main-carousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
<?php if( $sizeof_query > 1 ): ?>
<ol class="carousel-indicators">
<?php $i=0; ?>
<?php while( $carousel_query->have_posts() ) : $carousel_query->the_post(); ?>
<?php if( $i==0 ): ?>
<li data-target="#main-carousel" data-slide-to="<?php echo $i; ?>" class="active"></li>
<?php else: ?>
<li data-target="#main-carousel" data-slide-to="<?php echo $i; ?>"></li>
<?php endif; ?>
<?php $i++; endwhile; ?>
</ol>
<?php endif; ?>

<div class="carousel-inner">
<?php $i=0; ?>
<?php while( $carousel_query->have_posts() ) : $carousel_query->the_post(); ?>
<?php $url = get_post_custom_values('[URL]'); ?>
<?php $thumb_img_src = wp_get_attachment_image_src( get_post_thumbnail_id(), 'slide-1920-460'); // Get the post thumbnail img src ?>
<?php $thumb_url_src = $thumb_img_src[0]; // set the thumbnail src url, to use it as a background ?>

<?php if( $i==0 ): ?>
<div class="item active">
<?php else: ?>
<div class="item">
<?php endif; ?>

<?php if( has_post_thumbnail() ): ?>
<style type="text/css">
.slide-<?php echo $i; ?>{ background-image: url(<?php echo $thumb_url_src; ?>); }
</style>

<div class="carousel-slide slide-<?php echo $i; ?>">
<?php else: ?>
<div class="carousel-slide">
<?php endif; ?>

<?php if( get_the_content() ): ?>
<div class="container">
<div class="row">
<article class="col-xs-12">
<?php the_title('<h2>','</h2>'); ?>

<?php the_content(); ?>

<?php if($url[0]): ?>
<a class="primary-btn" href="<?php echo $url[0]; ?>">Ver más ≫</a>
<?php else: ?>
<a class="primary-btn" href="<?php the_permalink(); ?>">Ver más ≫</a>
<?php endif; ?>

</article><!-- end .col-xs-12 -->
</div><!-- end .row -->
</div><!-- end .container -->
<?php endif; ?>

</div><!-- end .carousel-slide slide- -->

</div><!-- end .item -->
<?php $i++; endwhile; ?>
</div><!-- end .carousel-inner -->

<?php if( $sizeof_query > 1 ): ?>
<!-- Controls -->
<a class="left carousel-control" href="#main-carousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#main-carousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
<?php endif; ?>

</div><!-- end #main-carousel -->

<?php wp_reset_postdata(); ?>
<?php else: ?>
<?php // No existen post con category Carousel ?>
<?php endif; ?>
Loading

0 comments on commit bc101ee

Please sign in to comment.