File: /var/www/html/site/newsite/wp-content/themes/waira/index.php
<?php
/**
* The main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package paira
*/
get_header();
?>
<?php if(get_theme_mod('paira_blog_enable')) : ?>
<!-- Blog Layout -->
<section class="paira-main site-main">
<div class="paira-main__hero">
<div class="container">
<div class="row">
<div class="col-12">
<div class="paira-slider">
<div class="swiper mySwiper paira-slider__active loading">
<div class="swiper-wrapper">
<?php
$paira_post_count = esc_attr(get_theme_mod( 'paira_post_count'));
$paira_blog_catId = esc_attr(get_theme_mod( 'paira_blog_category_id'));
$paira_blog_catLink = get_category_link($paira_blog_catId);
$paira_blog_CatName = get_category($paira_blog_catId);
$args = array(
'post_type' => 'post',
'posts_per_page' => $paira_post_count,
'post_status' => 'publish',
'cat' => $paira_blog_catId,
);
$paira_blogloop = new WP_Query($args);
while ($paira_blogloop->have_posts()) :
$paira_blogloop->the_post();
?>
<!-- Single Post Slider -->
<div class="paira-slider__single swiper-slide shadow">
<?php $categories = get_the_category(get_the_ID());?>
<div class="paira-slider__head">
<a href="<?php the_permalink();?>">
<?php the_post_thumbnail('paira-slider-thumb'); ?>
</a>
</div>
<!-- paira content -->
<div class="paira-slider__content">
<h2 class="paira-slider__title"><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h2>
<ul class="paira-post-meta paira-slider__meta">
<?php if ( empty (has_post_thumbnail())) : ?>
<li><i class="fa fa-pencil"></i><?php paira_posted_on(); ?></li>
<?php endif; ?>
<li><i class="fa fa-user"></i><a class="paira-post-meta__author" href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>"><?php
paira_posted_by(); ?></a></li>
<li><i class="fa fa-calendar"></i><?php echo esc_html(get_the_date());?></li>
</ul>
</div>
</div>
<?php endwhile;
wp_reset_postdata();
?>
</div>
</div>
<!-- If we need pagination -->
<div class="swiper-pagination"></div>
<!-- If we need navigation buttons -->
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php endif; ?>
<section class="paira-main-content">
<div class="container">
<div class="row">
<div class="col-12">
<div class="paira-main-area">
<div class="row ">
<?php if(is_active_sidebar('sidebar-2')) : ?>
<div class="col-lg-3 col-12">
<div class="paira-sidebar paira-sidebar__left">
<aside id="paira-secondary-sidebar" class="widget-area">
<?php dynamic_sidebar('sidebar-2'); ?>
</aside>
</div>
</div>
<?php endif;?>
<?php if(is_active_sidebar('sidebar-1') && is_active_sidebar('sidebar-2')): ?>
<div class="col-lg-6 col-12 paira-main-area__content">
<?php elseif(is_active_sidebar('sidebar-1') OR is_active_sidebar('sidebar-2')) :?>
<div class="col-lg-9 col-12">
<?php else : ?>
<div class="col-12">
<?php endif;?>
<div class="paira-post-content">
<div class="row">
<div class="col-12">
<div class="paira-home-layout">
<div class="paira-heading-group">
<h2 class="paira-heading-group__title"><?php esc_html_e('Latest Posts','paira');?> </h2>
<p class="paira-heading-group__text"><?php esc_html_e('Here is recent published blog posts.','paira');?></p>
</div>
<div class="row paira-masonry">
<?php
if ( have_posts() ) :
if ( is_home() && ! is_front_page() ) :
?>
<header>
<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
</header>
<?php
endif;
/* Start the Loop */
while ( have_posts() ) :
the_post();
/*
* Include the Post-Type-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_type() );
endwhile;
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<?php the_posts_navigation(); ?>
</div>
</div>
<div class="row">
<div class="col-12">
<!-- Start Pagination -->
<div class="pagination-main">
<?php if (function_exists("paira_pagination"))
{
paira_pagination();
}
?>
</div>
<!-- End Pagination -->
</div>
</div>
</div>
</div>
<?php if(is_active_sidebar('sidebar-1')) : ?>
<div class="col-lg-3 col-12">
<div class="paira-sidebar paira-sidebar__right">
<?php get_sidebar(); ?>
</div>
</div>
<?php endif;?>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- End Blog Layout -->
<?php get_footer();