0

I have a homepage with four displayed posts and one that is emphasized.

The one that is emphasized is not a problem, it's a large post whose details i collect using special loop.

But for those four posts (that have pagination), I just can't seem to exclude that emphasized one.

For example, if emphasized post has ID of 8, this should do the trick:

$args=array(
        'paged' => $paged,
        'posts_per_page' => 4,
        array('post__not_in' => array(8))
    );

    query_posts($args);

    while ( have_posts() ) : the_post();
        echo '<li>';
        the_title(); 
        echo "<span> ".$post->ID."</span>";
        echo '</li>';
    endwhile;

But for some reason it's not filtering anything, always displays all the posts.

Any ideas why this is happening?

4

1 回答 1

3

为什么post__not_in在另一个数组中?我建议将其放在同一级别:

$args=array(
        'paged' => $paged,
        'posts_per_page' => 4,
        'post__not_in' => array(8)
);

如果这没有帮助,我建议检查此处提到的方法。

于 2012-05-08T12:25:14.227 回答