I’ve got a bit of a problem I’m trying to resolve on this page:
It’s a site about books, and the site’s posts are exclusively split up between fiction, non-fiction & site news. I’m using a custom WP_Query function to keep the categories separate from each other. For example, this is how the fiction category looks under the hood:
<?php $my_query1 = new WP_Query('category_name=fiction&showposts=7'); while ($my_query1->have_posts()) : $my_query1->the_post(); $do_not_duplicate1 = $post->ID; ?>
Now I want to be able to specify certain posts to be excluded from front page display. I’ve tried modifying the parameters to something like this:
$my_query1 = new WP_Query('category_name=fiction&showposts=7&p=-1,-3,-7');
But the results have been disastrous. Does anyone know what I’m doing wrong? Better yet, does anyone know how to do it right? I’d really appreciate it if some kind soul could help point me in the right direction.
- The topic ‘Excluding specific posts from a custom WP_Query()’ is closed to new replies.