如何从第一个博客页面以外的博客页面隐藏滑块?

时间:2017-12-12 21:57:37

标签: php wordpress owl-carousel

我怎样才能隐藏Wordpress中的顶级滑块形成我的2,3,4 ...博客页面用php?这是我的剧本:

<section id="blog">
       <div class="owl-carousel">
          <?php $loop = new WP_Query(array('post_type' => 'post', 'posts_per_page' => -1, 'orderby'=> 'ASC')); ?> 
          <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
             <div class="recent-post">
                <div class="home-slider-img">
                    <?php echo the_post_thumbnail(); ?>
                </div> 
                <div class="feat-overlay">
                    <div class="feat-overlay-inner"> 
                        <div class="post-header">                     
                            <span class="cat"><?php the_category(', ') ?></span>
                            <h4><a href="<?php the_permalink(); ?>"><?php print get_the_title(); ?></a></h4>
                            <span class="date"><?php the_time('M j, Y') ?></span>
                            <p><a class="read-more" href="<?php print get_permalink($post->ID) ?>">Read More</a></p>
                        </div>      
                    </div>  
                </div>
            </div>
          <?php endwhile; ?>
       </div>
    </section>

1 个答案:

答案 0 :(得分:0)

var regEx = /(foo)/; doc.aa = regEx.exec(doc.aa)[1]; // return first matching group 函数应该执行您想要的操作 - https://developer.wordpress.org/reference/functions/is_home/

只需将is_home() div包装在if测试中,检查您是否在博客主页上这样:

owl-carousel