0
votes

I have 5 blog sections each representing a category. However, I would like to have a category called "all" that if checked would include the post in all 5 section without having to click every category.

I guess the only way to do this is to add something into the blog category template file to tell it to include the usual category posts as well as the "all" category.

now I think i've located where it queries the post: if ( $wp_query->have_posts()) : while (have_posts()) : the_post();

but there is nothing identifying the current category id, except for a few things above for specifying the right title for the theme.

What would be the best way of achieving what I have explained?

1

1 Answers

0
votes

You can interact with the wp_query object... the same way that you interact with query_posts()... it accepts the same arguments.

For either you can use Category Parameters as follows (from the wordpress codex: query_posts function reference)

Category Parameters Show posts associated with certain categories.

  • cat (int) - use category id.

  • category_name (string) - use category slug (NOT name).

  • category__and (array) - use category id.

  • category__in (array) - use category id.

  • category__not_in (array) - use category id.

When it references $wp_query, the variables of the query have already been defined, you can set up your own query with any parameteres you want.