<?php
$offset = '';
$item_read_more  = ot_get_option('item_read_more', false);
$per_page = get_option('posts_per_page');
$paged = (get_query_var('post') && get_query_var('paged') > 1) ? get_query_var('paged') : 1;
$show = ($offset == 0) ? 'posts_per_page=' . $item_read_more  : 'posts_per_page=' . $per_page;
$cat_1 = ot_get_option('category_select_id_1', '', false, true, 0);
$cat_2 = ot_get_option('category_select_id_2', '', false, true, 0);
$cat_3 = ot_get_option('category_select_id_3', '', false, true, 0);
$cat_4 = ot_get_option('category_select_id_4', '', false, true, 0);
$show_read_more  = ot_get_option('show_read_more', true);
if ($show_read_more  == 'on') :
?>
    <div class="container" style="padding: 0 7px;">
        <div class="row">
            <div class="newsWrapper_theme">
                <div class="col-12">
                    <h4><?php echo ot_get_option('text_read_more', __('Read more', 'liosa')); ?></h4>
                    <div class="row">
                        <div class="col-md-3 col-sm-6 col-xs-12">
                            <?php $category_link_1 = get_category_link($cat_1); ?>
                            <h5><a href="<?php echo esc_url($category_link_1); ?>"><?php echo get_cat_name($category_id = $cat_1); ?> <i class="fal fa-angle-left"></i></a></h5>
                            <ul class="newslist">
                                <?php
                                query_posts("cat=$cat_1&paged=$paged&$show");
                                ?>
                                <?php while (have_posts()) : the_post(); ?>
                                    <li>
                                        <a href="<?php the_permalink(); ?>">
                                            <span class="img right">
                                                <?php the_post_thumbnail('thumbnail'); ?>
                                            </span>
                                            <span class="title">
                                                <?php the_title(); ?>
                                            </span>
                                        </a>
                                    </li>
                                <?php endwhile; ?>
                            </ul>
                        </div>

                        <div class="col-md-3 col-sm-6 col-xs-12">
                            <?php $category_link_2 = get_category_link($cat_2); ?>
                            <h5><a href="<?php echo esc_url($category_link_2); ?>"><?php echo get_cat_name($category_id = $cat_2); ?> <i class="fal fa-angle-left"></i></a></h5>
                            <ul class="newslist">
                                <?php
                                query_posts("cat=$cat_2&paged=$paged&$show");
                                ?>
                                <?php while (have_posts()) : the_post(); ?>
                                    <li>
                                        <a href="<?php the_permalink(); ?>">
                                            <span class="img right">
                                                <?php the_post_thumbnail('thumbnail'); ?>
                                            </span>
                                            <span class="title">
                                                <?php the_title(); ?>
                                            </span>
                                        </a>
                                    </li>
                                <?php endwhile; ?>
                            </ul>
                        </div>

                        <div class="col-md-3 col-sm-6 col-xs-12">
                            <?php $category_link_3 = get_category_link($cat_3); ?>
                            <h5><a href="<?php echo esc_url($category_link_3); ?>"><?php echo get_cat_name($category_id = $cat_3); ?> <i class="fal fa-angle-left"></i></a></h5>
                            <ul class="newslist">
                                <?php
                                query_posts("cat=$cat_3&paged=$paged&$show");
                                ?>
                                <?php while (have_posts()) : the_post(); ?>
                                    <li>
                                        <a href="<?php the_permalink(); ?>">
                                            <span class="img right">
                                                <?php the_post_thumbnail('thumbnail'); ?>
                                            </span>
                                            <span class="title">
                                                <?php the_title(); ?>
                                            </span>
                                        </a>
                                    </li>
                                <?php endwhile; ?>
                            </ul>
                        </div>

                        <div class="col-md-3 col-sm-6 col-xs-12">
                            <?php $category_link_4 = get_category_link($cat_4); ?>
                            <h5><a href="<?php echo esc_url($category_link_4); ?>"><?php echo get_cat_name($category_id = $cat_4); ?> <i class="fal fa-angle-left"></i></a></h5>
                            <ul class="newslist">
                                <?php
                                query_posts("cat=$cat_4&paged=$paged&$show");
                                ?>
                                <?php while (have_posts()) : the_post(); ?>
                                    <li>
                                        <a href="<?php the_permalink(); ?>">
                                            <span class="img right">
                                                <?php the_post_thumbnail('thumbnail'); ?>
                                            </span>
                                            <span class="title">
                                                <?php the_title(); ?>
                                            </span>
                                        </a>
                                    </li>
                                <?php endwhile; ?>
                            </ul>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
<?php endif; ?>