0

i have attached custom taxonomies to posts.

now i'm looking for the best way, architecturally speaking, for automatically creating list that would look like this:

energy (32):

  • how to build a solar system (asaf)
  • how to fix a solar panel (saar)
  • managing your lead-acid deep-cycle battery (ofra)
  • hybrid system design (asaf)
  • take the green pill (saar)

more energy? ->

explanation: it should query all instances of a specific taxonomy (let say tags, and afterwards i'll do the same with other taxonomies as well) and make a list of that will have the tag name as a title with number of posts in the tag in brackets, and a list of the newest posts under that list with the author name in brackets.each post should link to the post, and name of author should link to the author page. in the bottom it should have a generic link to that specific tag archive page.

the function i'm trying to build should generate that list automatically for every tag that has more then 10 posts tagged.

the next difficulty level is to make it show every post only one time (for posts that are tagged with number of tags it will show the post only on the first tag).

i've tried to find a plugin that i can tweak to doing that but i could not find any thing close enough, so i decided to build it myself. what i'm asking is for everything between a a tip for the road and a "yesterday i've developed the same function, it's working great, here's the code. have fun".

Cheers, Asaf.

1 Answer 1

1

I think this is a custom code job.

But here is the query logic I'd use to build this.

  1. do a get_terms() for your custom taxonomy.
  2. Loop through each term
  3. Inside loop do a query_posts() for posts with that taxonomy excluding previous post ID's and limiting the return to 10.
  4. If 10 posts are return then show tax title and then list the ten posts titles using the_title() and the_permalink().
  5. Make sure you have a variable that holds post ID of displayed posts so to exclude them on the next tax.

If you need help with code for any of those bits then leave a comment and I'll be sure to add to my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.