Support » Themes and Templates » WP Query exclude category_name

  • I’ve got two loops.

    One loop pulls the last four items from a category called “featured” thus:

    $my_query = new WP_Query(‘category_name=featured&showposts=4’);

    I’d like to have a second loop which pulls the last 8 items for every category EXCEPT featured. I wrote it using the minus sign to remove the unwanted category as:

    $my_query = new WP_Query(‘category_name=-featured&showposts=8’);

    But that does’t work. Any ideas of a better way of doing this?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP Query exclude category_name’ is closed to new replies.