简体   繁体   English

每4个帖子网格创建一个全角帖子-Wordpress Loop

[英]Create a full-width post every 4 post grids - Wordpress Loop

How can I create a full-width post every 4 post grids? 如何每4个帖子网格创建一个全角帖子? As in the following picture. 如下图所示。

在此处输入图片说明

Here is my code wordpress loop. 这是我的代码wordpress循环。

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <article id="post-<?php the_ID(); ?>" <?php post_class('col-sm-6 grid-item '); ?>>

        <div class="entry-image">
            <a href="<?php echo get_permalink() ?>"><?php the_post_thumbnail('grid-thumb'); ?></a>
            <?php unbranded_entry_footer(); ?>
        </div>

        <header class="entry-header">
            <?php
            the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );

            if ( 'post' === get_post_type() ) : ?>
            <div class="entry-meta">
                <?php unbranded_posted_on(); ?>
            </div><!-- .entry-meta -->
            <?php
            endif; ?>
        </header><!-- .entry-header -->

        <div class="entry-content">
            <p><?php echo unbranded_string_limit_words(get_the_excerpt(), 18); ?>&hellip;</p>
        </div><!-- .entry-content -->
    </article>

<?php endwhile; endif; ?>

May I know are you using visual composer or creating custom template? 我可以知道您是使用视觉作曲家还是创建自定义模板? If using visual composer you can do it from back-end or place the condition to disable the sidebar from right using above the sidebar in page.php 如果使用Visual Composer,则可以从后端进行操作,也可以在page.php的侧边栏上方放置从右侧禁用侧边栏的条件

<?php if(!is_page('your-page-slug' or ID)) { ?>

/*sidebar code*/

<?php } ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM