Как я могу изменить цикл Wordpress для сетки начальной загрузки без использования «смещения» - PullRequest
0 голосов
/ 04 февраля 2019

Как я могу изменить этот цикл для начальной загрузки?Я не хочу использовать offset.Можете ли вы дать мне другой код, как это без offset?

enter image description here

<div class="container-fluid">
    <div class="row">
        <div class="col-lg-6 pn">
            <?php 
                $args = array(
                    'posts_per_page' => 1,
                    'offset' => 0
                );
                $tech__loop = new WP_Query($args);
                while ($tech__loop->have_posts()) :  $tech__loop->the_post(); ?>
            <article id="post-<?php the_ID(); ?>" <?php post_class( 'i-latest-post' ); ?>>
                <figure class="overlay fill-img">
                    <?php if ( has_post_thumbnail() ) : ?>
                    <a class="thumb" href="<?php echo esc_url( the_permalink() ); ?>">
                        <?php the_post_thumbnail('custom-size', array('class' => 'img-fluid') ); ?>
                    </a>
                    <?php endif; ?>
                    <figcaption>
                        <div class="article-title small">
                            <h2>
                                <a href="<?php echo esc_url( the_permalink() ); ?>">
                                    <?php the_title(); ?>
                                </a>
                            </h2>
                        </div>
                    </figcaption>
                </figure>
            </article>
            <?php endwhile; ?>
        </div>
        <div class="col-lg-3 pn">
            <?php 
                $args = array(
                'posts_per_page' => 2,
                    'offset' => 1
                );
                $tech__loop = new WP_Query($args);
                while ($tech__loop->have_posts()) :  $tech__loop->the_post(); ?>
            <article id="post-<?php the_ID(); ?>" <?php post_class( 'i-latest-post' ); ?>>
                <figure class="overlay fill-img">
                    <?php if ( has_post_thumbnail() ) : ?>
                    <a class="thumb" href="<?php echo esc_url( the_permalink() ); ?>">
                        <?php the_post_thumbnail('custom-size', array('class' => 'img-fluid') ); ?>
                    </a>
                    <?php endif; ?>
                    <figcaption>
                        <div class="article-title small">
                            <h2>
                                <a href="<?php echo esc_url( the_permalink() ); ?>">
                                    <?php the_title(); ?>
                                </a>
                            </h2>
                        </div>
                    </figcaption>
                </figure>
            </article>
            <?php endwhile; ?>
        </div>
        <div class="col-lg-3 pn">
            <?php 
                $args = array(
                    'posts_per_page' => 2,
                    'offset' => 3
                );
                $tech__loop = new WP_Query($args);
                while ($tech__loop->have_posts()) :  $tech__loop->the_post(); ?>
            <article id="post-<?php the_ID(); ?>" <?php post_class( 'i-latest-post' ); ?>>
                <figure class="overlay fill-img">
                    <?php if ( has_post_thumbnail() ) : ?>
                    <a class="thumb" href="<?php echo esc_url( the_permalink() ); ?>">
                        <?php the_post_thumbnail('custom-size', array('class' => 'img-fluid') ); ?>
                    </a>
                    <?php endif; ?>
                    <figcaption>
                        <div class="article-title small">
                            <h2>
                                <a href="<?php echo esc_url( the_permalink() ); ?>">
                                    <?php the_title(); ?>
                                </a>
                            </h2>
                        </div>
                    </figcaption>
                </figure>
            </article>
            <?php endwhile; wp_reset_postdata(); ?>
        </div>
    </div>
    <!-- /.row -->
</div>
<!-- /.container-fluid -->
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...