How to Exclude Posts While Using Showposts offset
-
I know very little about PHP and I’ve been fumbling around with this for a while, but I’m stumped. Hopefully I can explain this problem clearly enough.
On my home page the theme displays recent posts in different formats i.e. the most recent two within a larger feature block, the next 4 in a smaller block and the rest as a list. The original code looked like this:
query_posts( 'showposts=2' ); if (have_posts()) : while (have_posts()) : the_post(); $category = get_the_category();
However, I want to exclude any “news” posts in the query. Unfortunately, the solution I came up with results in duplicate articles in each segment block as you can see on my site https://www.cinemadiving.com.
The change I made:
query_posts( array( 'showposts' => '2', 'cat' => '-20,-18') ); if (have_posts()) : while (have_posts()) : the_post(); $category = get_the_category();
I would be extremely grateful if anyone could help with this?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to Exclude Posts While Using Showposts offset’ is closed to new replies.