<?php
/*
Theme Designed By: Meysam Hosseinkhani
Email: Meysam98@Gmail.com
Author Website: Hosseinkhani.ir
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
global $di_data;
get_header(); 
$pside = get_post_meta( get_the_ID(), 'dina_pageside', true );
$content_sticky = ($di_data['side_sticky'] ? ' content-sticky' : '');
if(is_cart() || is_checkout()) {
    $row = '';
    $article = 'col-12'.$content_sticky;
} elseif($pside == '') {
    if($di_data['page_side']==0) {
        $row = '';
        $article = 'col-12'.$content_sticky;
    } elseif($di_data['page_side']==1) {
        $row = '';
        $article = 'col-lg-9 col-12'.$content_sticky;
    } elseif($di_data['page_side']==2){
        $row = ' right-side';
        $article = 'col-lg-9 col-12'.$content_sticky;
    }
} elseif($pside == 'lside') {
    $row = '';
    $article = 'col-lg-9 col-12'.$content_sticky;
} elseif($pside == 'rside') {
    $row = ' right-side';
    $article = 'col-lg-9 col-12'.$content_sticky;
} elseif ($pside == 'wside') {
    $row = '';
    $article = 'col-12'.$content_sticky;
}
?>
<div class="container main-con">
<?php if($di_data['show_bread']) { woocommerce_breadcrumb(); } ?>
<div class="row page-row<?php echo $row; ?>">
<?php if ( have_posts() ) : ?>
<article role="main"  class="<?php echo $article; ?>">
<?php while ( have_posts() ) : the_post(); ?>
<div class="shadow-box page-con" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <h1 class="ptitle">
        <?php the_title(); ?>
    </h1>
    <div class="entry-content">

    <?php if ( has_post_thumbnail() && $di_data['show_page_thumb']) { ?>
        <div class="post-img">
            <?php the_post_thumbnail('larg'); ?>
        </div>
    <?php } ?>

    <?php the_content(); ?>
    </div>
    <?php
    $defaults = array(
        'before'           => '<div class="text-center apage-break">',
        'after'            => '</div>',
        'link_before'      => '',
        'link_after'       => '',
        'next_or_number'   => 'text',
        'separator'        => ' ',
        'nextpagelink'     => '<span class="btn btn-outline-info">'.__('Next Page ', 'dina-kala').'<i aria-hidden="true" class="fal fa-angle-left"></i></span>',
        'previouspagelink' => '<span class="btn btn-outline-info"><i aria-hidden="true" class="fal fa-angle-right"></i>'.__(' Prev Page', 'dina-kala').'</span>',
        'pagelink'         => '%',
        'echo'             => 1
    );
    wp_link_pages($defaults); ?>
</div>
<?php endwhile; ?>
<?php if ( comments_open() ) : ?>
    <div class="shadow-box comments-list">
            <?php comments_template(); ?> 
    </div>
<?php endif; ?>
</article>
<?php endif; 

if(is_cart() || is_checkout()) {
    //Do Nothing!
} elseif ( $pside == '' && $di_data['page_side'] > 0 ) {
    get_sidebar();
} elseif ( $pside != 'wside' && $pside != '' ) {
    get_sidebar();
} ?>
</div>
</div>
<?php get_footer();