Tell to a query to select only the current category in the archive template
It must be something obvious but I can’t find it ! So I call some help. Sometimes you are searching your glasses and they are on your nose, isn’t it ?
I have made a dropdownmenu witch list each category on my blog with :
<? wp_list_cats('sort_column=name&exclude=7'); ?>
When you click on “Books”, you arrive on the category page. This one obeys to the archive template and so display the list of all the posts in this particular category. Easy until this point.
My problem is that I want too to display 2 posts (with title, texte and all stuff) of this category below this list… randomly !
So I have installed this wonderfull plugin (works like a charm) : http://wordpress.org/support/topic/70359?replies=3
And I have put like it is advised this line in my archive template :
<? query_posts('cat=&showposts=2&random=true'); ?>
2 posts are displayed randomly… but I can’t find how to indicate to the query that she must take these posts in the current category… and I don’t want to make 11 different templates… There must be a solution.
I have try is_category() whithout success, some pieces of code about current category in the codex and it doesn’t work. I have search on the forum and found nothing about my problem.
Is there someone to save me and the world ?
THanks in advance for your attention.
- The topic ‘Tell to a query to select only the current category in the archive template’ is closed to new replies.