wp loop bootstrap grid

145
15 сентября 2019, 22:50

Каким кодом можно заменить этот цикл без offset?

<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 -->

READ ALSO
Как настроить htaccess?

Как настроить htaccess?

Имеется сайт на неопределенной CMS (предположительно parallels), у него в корне лежит htaccess, в котором мне мешает жить одна строчка

133
Склонение числительных

Склонение числительных

Помогите сделать php код, который бы отталкиваясь от числа писал правильные окончания к "тем", по типу 1 тема, 2 темы, 11 тем

168
Ошибка в сессии php

Ошибка в сессии php

Подскажите пожалуйста, есть код, который открывает сессию php:

130
Как принять и обработать canvas на сервере?

Как принять и обработать canvas на сервере?

Не получается принять на сервере canvasОн даже не фигурирует в массиве $_POST HTML

162