File "single-case.php"
Full Path: /home/flipjqml/onlinebetsolution.com/wp-content/themes/cyarb/single-case.php
File size: 6.76 KB
MIME-type: text/x-php
Charset: utf-8
<?php global $cyarb_opt;
/**
* Single Case
*/
get_header();
// Case banner and breadcrumb
if ( isset($cyarb_opt['hide_case_banner']) ) {
$hide_case_breadcrumb = $cyarb_opt['hide_case_breadcrumb'];
$hide_case_banner = $cyarb_opt['hide_case_banner'];
} else {
$hide_case_breadcrumb = false;
$hide_case_banner = false;
}
// After Hiding Banner add spacing
if( $hide_case_banner == true){
$page_spac = 'mt-80';
} else {
$page_spac = '';
}
if( function_exists('acf_add_options_page') ) {
$bg_img = get_field( 'banner_background_image' );
$banner_title = get_field( 'page_banner_title' );
}else {
$bg_img = '';
$banner_title = '';
}
// page banner shape image
if( isset( $cyarb_opt['cyarb_banner_image_shape'] ) ):
$banner_shape = $cyarb_opt['cyarb_banner_image_shape'];
else:
$banner_shape = '';
endif;
$count_cat = !empty($cyarb_opt['count_tag']) ? $cyarb_opt['count_tag'] : 1;
?>
<?php if( $hide_case_banner == false ): ?>
<div class="page-title-area bg-18" style="background-image:url(<?php echo esc_url( $bg_img ); ?>);">
<div class="container">
<div class="page-title-content">
<h1><?php the_title(); ?></h1>
<?php if( $hide_case_breadcrumb == false ) : ?>
<ul>
<li>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php esc_html_e('Home', 'cyarb')?>
</a>
</li>
<li class="active"><?php the_title(); ?></li>
</ul><?php
endif; ?>
</div>
</div>
<?php if( $banner_shape == 1 ) : ?>
<div class="shape1"><img src="<?php echo esc_url(get_template_directory_uri() .'/assets/img/shape/shape1.png' ); ?>" alt="<?php the_title_attribute(); ?>"></div>
<div class="shape2"><img src="<?php echo esc_url(get_template_directory_uri() .'/assets/img/shape/shape2.png' ); ?>" alt="<?php the_title_attribute(); ?>"></div>
<div class="shape4"><img src="<?php echo esc_url(get_template_directory_uri() .'/assets/img/shape/shape4.png' ); ?>" alt="<?php the_title_attribute(); ?>"></div>
<div class="shape5"><img src="<?php echo esc_url(get_template_directory_uri() .'/assets/img/shape/shape5.png' ); ?>" alt="<?php the_title_attribute(); ?>"></div>
<?php endif; ?>
</div>
<?php endif; ?>
<section class="case-details-area <?php echo esc_attr($page_spac); ?>">
<?php while(have_posts()): the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
</section>
<?php
$is_related = !empty($cyarb_opt['is_cases_related_posts']) ? $cyarb_opt['is_cases_related_posts'] : '';
$cats = get_the_terms(get_the_ID(), 'case_cat' );
$cats_id = wp_list_pluck($cats,'term_id' );
if ( isset( $cyarb_opt['related_cases_post'] ) && $cyarb_opt['related_cases_post'] !='' ) {
$related_post_count = $cyarb_opt['related_cases_post'];
} else {
$related_post_count = '2';
}
$rel_posts = new WP_Query( array(
'post_type' => 'case',
'tax_query' => array(
array(
'taxonomy' => 'case_cat',
'field' => 'id',
'terms' => $cats_id,
'operator' => 'IN' //Or 'AND' or 'NOT IN'
)),
'posts_per_page' => $related_post_count,
'ignore_sticky_posts' => 1,
'orderby' => 'rand',
'post__not_in' => array($post->ID)
));
?>
<?php if ( $is_related == '1' & $rel_posts->have_posts() ) : ?>
<div class="resources-area pt-100 pb-75">
<div class="container">
<?php if ( !empty( $cyarb_opt['cases_related_posts_title'] ) ) : ?>
<div class="section-title">
<h2><?php echo esc_html( $cyarb_opt['cases_related_posts_title'] ) ?></h2>
<p><?php echo esc_html( $cyarb_opt['cases_related_posts_content'] ) ?></p>
</div>
<?php endif; ?>
<div class="row justify-content-center">
<?php while( $rel_posts->have_posts() ) : $rel_posts->the_post(); ?>
<div class="col-lg-6 col-md-6">
<div class="single-resources-box">
<div class="image">
<a href="<?php the_permalink(); ?>" class="d-block">
<img src="<?php echo esc_url(get_the_post_thumbnail_url($id, 'cyarb_case_thumb')); ?>" alt="<?php the_title_attribute(); ?>">
</a>
</div>
<div class="content">
<?php $case_tags = get_terms('case_tag');
if( !empty( $case_tags ) && ! is_wp_error( $case_tags )) {
$i = 1;
foreach( $case_tags as $tag){ ?>
<div class="category">
<?php echo get_the_term_list( get_the_ID(), 'case_tag' ); ?>
</div>
<?php
if( $i == $count_cat ){ break;
$i++;
}
}
}
?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>" class="link-btn"><?php echo esc_html( $cyarb_opt['service_readmore_label'] ) ?> <i class="lni lni-chevron-right"></i></a>
</div>
</div>
</div>
<?php endwhile;
wp_reset_postdata();
?>
</div>
</div>
</div>
<?php endif; ?>
<?php get_footer();