File: /var/www/captainschairit.com/wp-content/themes/captainschare/template-parts/testimonial.php
<?php
/**
* Template Name: Testimonial Page
*/
get_header();
$banner_section = get_field('banner_section');
// echo '<pre>'; print_r($banner_section);
?>
<!-- Header -->
<header class="masthead-inner" id="about-us" style="background-image: url(<?php echo $banner_section['background_image']; ?>)">
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-8 offset-lg-2">
<div class="intro-text text-center">
<div class="intro-heading"><?php echo $banner_section['text']; ?></div>
</div>
</div>
</div>
</div>
</header>
<!-- Services -->
<?php
// echo '<pre>'; print_r($information_section);
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'posts_per_page' => 5,
'orderby' => 'date',
'order' => 'ASC',
'post_type' => 'cc-testimonials',
'post_status' => 'publish',
'paged' => $paged,
);
$testimonials = new WP_Query( $args );
// echo '<pre>'; print_r ($blog_posts); echo '</pre>';
?>
<section class="page-section" id="CompanyInfo">
<div class="container">
<?php
if ( $testimonials->have_posts() ) {
$count = 1;
while ( $testimonials->have_posts() ) : $testimonials->the_post();
$postid = get_the_ID();
$featured_img_url = get_the_post_thumbnail_url($postid,'full');
$content = get_field( "content", $postid ); ?>
<div class="row testimonial-container">
<?php if($count%2!=0) { ?>
<div class="col-lg-4">
<div class="testimonial-log">
<img src="<?php echo $featured_img_url; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>">
</div>
</div>
<?php
} ?>
<div class="col-lg-8">
<div class="testimonial <?php echo ($count%2==0)?'testimonial-right':''; ?>">
<blockquote>
<span class="leftq quotes">“</span><?php echo $content; ?><span class="rightq quotes">„ </span>
</blockquote>
</div>
</div>
<?php if($count%2==0) { ?>
<div class="col-lg-4">
<div class="testimonial-log-right">
<img src="<?php echo $featured_img_url; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>">
</div>
</div>
<?php
} ?>
</div>
<?php
$count++;
endwhile;
?>
<!-- Here Goes Pegination Start -->
<div class="pagination-section">
<ul class="pagination pull-right">
<?php
global $wp_query;
$big = 999999999;
$total_pages = $testimonials->max_num_pages;
//echo $total_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
$links = paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => 'page/%#%',
'current' => $current_page,
'total' => $total_pages,
'type' => 'array',
'prev_text' => __('<i class="fa fa-angle-double-left" aria-hidden="true"></i>'),
'next_text' => __('<i class="fa fa-angle-double-right" aria-hidden="true"></i>')
));
foreach ($links as $link) { ?>
<li class="page-item"><?php echo str_replace('page-numbers', 'page-link', $link); ?></li>
<?php
}
}
?>
</ul>
</div>
<!-- Here Goes Pegination End -->
<?php
wp_reset_postdata();
} ?>
<!-- WP-Post End -->
</div>
</section>
<?php
get_footer();
?>