<?php
$args = array(
    'post_type' => 'slider',
    'posts_per_page' => 3,
    'no_found_rows' => true,
);
$loop = new WP_Query($args);
if ($loop->have_posts()) :
    ?>

    <section class="slider">
        <div class="main-slider owl-carousel">
            <?php while ($loop->have_posts()) : $loop->the_post(); ?>
                <div class="mainItem">
                    <?php the_post_thumbnail('large', ['class' => 'img-fluid slid-thumb w-100']); ?>
                    <div class="mainItem-overlay d-flex flex-column justify-content-center">
                        <div class="container">
                            <div class="row justify-content-center">
                                <div class="col-md-8">
                                    <div class="slid-body text-center">
                                        <h3 class="slid-tit">
                                            <?php the_title(); ?>
                                        </h3>
                                        <div class="slid-url">
                                            <a class="main-btn"
                                               href="<?php the_permalink(); ?>"
                                               title="<?php the_title(); ?>">
                                                <span><?php _e('اقرأ المزيد', 'm7md') ?></span>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            <?php endwhile; ?>
        </div>
    </section>
<?php endif;
wp_reset_postdata(); ?>