This is my first post, I hope that during work with wordpress I'll gain useful knowledge and I'll be able to share it with you :).
My question concerns wp_query.
I have few categories on my site, let's say it's:
-articles (parent of below listed)
And I have a post X that belongs to sport, articles and featured. On a specific place (using templates) I'd like to list posts belonging at same time to sport and featured but not those belonging to sport only. So if X belongs to SPORTS - it's not listed. If it belongs to SPORTS and FEATURED it is listed.
Here's another catch: I'd like those posts to be displayed by category.php so I could detect what category is being displayed. So: if I'm browsing ARTICLES the query should list ARTICLES&FEATURED if in SPORT - SPORT&FEATURED.
Here's my query:
<?php $featured = new WP_Query('category_name=featured' ); ?>
<?php while ($featured->have_posts()) : $featured->the_post(); ?>
I do not know hot to get current category here and how to link it with 'category_name=featured' in the query.
Any suggestions will be appreciated.