pahroblem on "help with excluding posts from another loop"

ساخت وبلاگ

Hello everyone,

Was hoping someone could guide me on how to exclude posts in a loop that appeared in another loop on the same page.. here is an example of our front page.

http://ptscr.com/bqoeuz

As you can see the first area is the latest articles from throughout the website and the 2nd area is just the latest news..

here is the code..

<div id="featured-topics">
<?php $count = 0; ?>
<?php $args = array( 'posts_per_page' => 4, ); $posts = get_posts( $args ); ?>
<?php foreach (array_chunk($posts, 1, true) as $posts) : $count++; ?> <?php foreach( $posts as $post ) : setup_postdata($post); ?> <div class="column-<?php echo $count; ?>"> <a class="featured-<?php echo $count; ?>" href="<?php the_permalink(); ?>" style="background-image: url('<?php the_post_thumbnail_url( $size ); ?>' )"> <div class="featured-box"> <h2 class="featuredheading-<?php echo $count; ?>"> <?php the_title(); ?> </h2> <p class="featured-date">By <b><?php the_author(); ?></b> | <?php the_date(); ?></p> <p class="date-underline"></p> </div> <!-- featured-box --> </a> </div> <!-- column/featured --> <?php endforeach; ?>
<?php endforeach; ?>
</div> <!-- Featured Topics -->
<div id="row-container">
<h2 class="main-heading">Latest game news</h2>
<div class="article-loop">
<?php
$args = array(
'post_type' => array( 'post'),
'posts_per_page' => 4,
'category_name' => 'news',
);
$the_query = new WP_Query( $args );
?>
<?php if ( $the_query->have_posts() ) : ?>
<?php $count = 0; ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php $count++; ?>
<?php if ($count == 4) : ?>
<div class="featured-article">
<a href="<?php echo the_permalink(); ?>"> <div class="featured-thumb">
<?php echo get_the_post_thumbnail($post->ID, 'plant-thumb');
?>
<span class="article-overlay"> <h4 class="article-item-title"><?php the_title(); ?></h4> <p class="featured-date">By <b><?php the_author(); ?></b> | <?php the_date(); ?></p> <p class="date-underline"></p>
</span> <!-- article-overlay --> </div> <!-- featured-thumb -->
</a>
</div> <!-- featured-article -->
<div class="ad-holder">
<div class="item-ad">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- 300 x 250 -->
<ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-7568065840567088" data-ad-slot="1234194857"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
<?php else : ?> <?php get_template_part( 'content-basic' ); ?> <?php endif; ?> <?php endwhile; ?> <?php endif; ?>
</div> <!-- articles-loop -->

How would i get it so that the latest news loop doesn't include the posts from the featured articles above it?

thanks in advance!

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 299 تاريخ : يکشنبه 20 تير 1395 ساعت: 10:57