limit displayed links by two categories
-
I would like to be able to display a list of links only if they are present in two different link categories.
For example, I have a list of country names as link categories, and I have a list of link categories that are specific to each country: human rights organizations, political parties, etc. I want to be able to say, “Only show me links are categorized as both human rights organizations and Egypt.”
Is this possible?
I am doing a similar thing with blog posts using query_posts in the template just before the Loop as follows:
<?php query_posts(array('category__and'=>array($country_cat_id,98),'showposts'=>3)); ?>
Any help would be greatly appreciated. Otherwise, I will need to have 12 categories for each country, and that seems a little ridiculous when multiplied by 26.
I am open to a direct WordPress oriented way or a clever piece of PHP code that saves the links to an array and then compares and outputs a final list for printing. I know that this can be done, but I haven’t written a sort algorithm in a long time, and don’t really remember the best one to use.
Thanks
- The topic ‘limit displayed links by two categories’ is closed to new replies.