File: /var/www/dev.captainschairit.com/wp-content/themes/captainschare/template-parts/pricing.php
<?php
/**
* Template Name: Pricing
*/
// $base_url = get_option( 'api_base' );
// $api = '/api/cc/get-subcription-plans';
// $request_body = '';
// $args_business_listings = array(
// 'timeout' => 120,
// 'redirection' => 5,
// 'httpversion' => '1.0',
// 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url(),
// // 'blocking' => true,
// 'headers' => array('Accept' => 'application/json', 'Content-Type' => 'application/json'),
// // 'cookies' => array(),
// 'body' => json_encode($request_body),
// );
// $reasult = wp_remote_post($base_url . $api, $args_business_listings);
// // $parsed_ststes = json_decode(wp_remote_retrieve_body($states), true);
// $response_body = json_decode(wp_remote_retrieve_body($reasult), true);
// echo $api.'<pre>'; print_r($reasult);
// echo '<pre>'; print_r($response_body); exit;
get_header();
if (have_posts()) : while (have_posts()) : the_post();
$banner_section = get_field('banner_section');
$content = get_field('content');
$video_link = get_field('video_link');
?>
<!-- Header -->
<header class="masthead-inner" 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>
<div class="container">
<div class="row mb-5 pb-5">
<div class="col-lg-12">
<div class="ch-plan-tabs">
<div class="tab-content">
<p class="mt-5"><?php echo $content; ?></p>
<div class="panel-body">
<div class="table-responsive choose-price-plan">
<table class="table table-bordered table-striped mb-5">
<thead>
<tr>
<th class="light-gray-border-btn"> </th>
<?php
$terms = get_terms( array(
'taxonomy' => 'cc-pricing-plans',
'hide_empty' => false,
) );
// echo '<pre>'; print_r($terms);
foreach($terms as $term) {
?>
<th class="light-orange-bg light-gray-border text-center text-nowrap light-gray-border-btn"><?php echo $term->name; ?></th>
<?php
} ?>
</tr>
</thead>
<tbody>
<?php
$args = array(
'post_type' => 'cc-pricings',
'order' => 'ASC',
'posts_per_page' => 12,
'post_status' => 'publish'
);
$loop = get_posts( $args );
// echo '<pre>'; print_r($loop);
$count = 1;
// $product = get_post( $loop );
?>
<?php
$count = 1;
foreach($loop as $pricing) {
$crewman = get_field('crewman' , $pricing->ID);
$lieutenant = get_field('lieutenant' , $pricing->ID);
$captain = get_field('captain' , $pricing->ID);
?>
<tr>
<?php if($crewman['text'] != '') { ?>
<td class="text-nowrap light-gray-border <?php echo ($count % 2 == 0)?'light-sky-bg':'light-blue-bg' ?>"><?php echo $pricing->post_title; ?></td>
<td class="text-center light-gray-border <?php echo ($count % 2 == 0)?'light-sky-bg':'light-blue-bg' ?> text-nowrap"><?php echo $crewman['text']; ?></td>
<td class="text-center light-gray-border <?php echo ($count % 2 == 0)?'light-sky-bg':'light-blue-bg' ?> text-nowrap"><?php echo $lieutenant['text']; ?></td>
<td class="text-center <?php echo ($count % 2 == 0)?'light-sky-bg':'light-blue-bg' ?> light-gray-border-btn text-nowrap"><?php echo $captain['text']; ?></td>
<?php
} else { ?>
<td class="text-nowrap light-gray-border light-gray-border-btn <?php echo ($count % 2 == 0)?'light-sky-bg':'light-blue-bg' ?>"><?php echo $pricing->post_title; ?></td>
<td class="orange-text text-center light-gray-border light-gray-border-btn <?php echo ($count % 2 == 0)?'light-sky-bg':'light-blue-bg' ?> text-nowrap"> <?php echo ($crewman['eligible'])?'<i class="fas fa-check"></i>':'<i class="fas fa-times"></i>'; ?></td>
<td class="orange-text text-center light-gray-border light-gray-border-btn <?php echo ($count % 2 == 0)?'light-sky-bg':'light-blue-bg' ?> text-nowrap"> <?php echo ($lieutenant['eligible'])?'<i class="fas fa-check"></i>':'<i class="fas fa-times"></i>'; ?></td>
<td class="orange-text text-center light-gray-border-btn <?php echo ($count % 2 == 0)?'light-sky-bg':'light-blue-bg' ?> text-nowrap"> <?php echo ($captain['eligible'])?'<i class="fas fa-check"></i>':'<i class="fas fa-times"></i>'; ?></td>
<?php
} ?>
</tr>
<?php
$count++;
} ?>
</tbody>
</table>
</div>
<div class="pricing-top-part">
<div class="text-center d-block clearfix col-sm">
<!-- <button type="button" onclick="window.location.href='<?php //echo get_site_url() ?>/collect-data-for-msp?val=set'" class="btn btn-primary btn-rounded hvr-shutter-out-horizontal text-transform">Begin Free 30-Day Preview</button> -->
</div>
</div>
<div class="col-sm-10 col-md-10 col-lg-10 offset-sm-1 offset-md-1 offset-lg-1">
<div class="mt-5 pricing-video">
<div class="embed-responsive">
<iframe class="responsive-video" src="<?php echo $video_link; ?>?autoplay=true" frameborder="0" allow="autoplay; fullscreen" sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-presentation" allowfullscreen>
</iframe>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- The Modal -->
<?php
endwhile;
endif;
get_footer();
?>