Created
May 26, 2017 08:11
-
-
Save anonymous/a67f9ca49997af2381dae49e8c8146ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template part for displaying home testimonials section. | |
* | |
* @package Onefold | |
*/ | |
?> | |
<?php | |
$testimonials_title = onefold_get_option( 'testimonials_title' ); | |
$testimonials_number = onefold_get_option( 'testimonials_number' ); | |
$testimonials_category = onefold_get_option( 'testimonials_category' ); | |
?> | |
<div id="onefold-testimonials" class="home-section-testimonials"> | |
<div class="container"> | |
<h2 class="section-title"><?php echo esc_html( $testimonials_title ); ?></h2> | |
<?php | |
$qargs = array( | |
'posts_per_page' => absint( $testimonials_number ), | |
'no_found_rows' => true, | |
); | |
if ( absint( $testimonials_category ) > 0 ) { | |
$qargs['cat'] = absint( $testimonials_category ); | |
} | |
// Fetch posts. | |
$the_query = new WP_Query( $qargs ); | |
?> | |
<?php if ( $the_query->have_posts() ) : ?> | |
<div class="testimonials-wrapper"> | |
<div class="cycle-slideshow" | |
data-cycle-slides="> article" | |
data-cycle-auto-height="container" | |
data-cycle-timeout="8000" | |
> | |
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> | |
<article class="testimonials-item"> | |
<div class="testimonials-item-inner"> | |
<?php if ( has_post_thumbnail() ) : ?> | |
<a class="testimonials-thumb" href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'thumbnail' ); ?></a> | |
<?php endif; ?> | |
<div class="testimonials-content-area"> | |
<?php the_excerpt(); ?> | |
</div><!-- .testimonials-content-area --> | |
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> | |
</div><!-- .testimonials-item-inner --> | |
</article><!-- .testimonials-item --> | |
<?php endwhile; ?> | |
<!-- pager --> | |
<div class="cycle-pager"></div> | |
</div><!-- .cycle-slideshow --> | |
</div><!-- .testimonials-wrapper --> | |
<?php wp_reset_postdata(); ?> | |
<?php endif; ?> | |
</div><!-- .container --> | |
</div><!-- .home-section-testimonials --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment