• I have a site that is to be organized using both categories and tags. Posts will be grouped based on tags. On the main page, I want to display the most recent posts from the three most recently used tags – so fetching the three most recently used tags is key. The three displayed posts just need to be (a) the most recently modified posts and (b) from unique tags (posts only have one tag each).

    The other option would be to use a couple loops and a one post query while loop, checking for duplicate tags within the posts it’s selecting, most recent down. I can’t figure out exactly how I would do this, though, so the former option seems more logical.

    Any help would be appreciated! Thanks in advance.

Viewing 1 replies (of 1 total)
  • So the plan of action would be:
    1. Initialize an array of tags ‘encountered’
    2. Get all posts in descending date order
    3. Iterate through the posts while the tags ‘encountered’ array has less then 3 elements.
    3a. For each post get the post_tags, check the array of tags ‘encountered’ if the post has a new tag, add that tag to the tags ‘encountered’ array and display the post.

Viewing 1 replies (of 1 total)
  • The topic ‘Retrieving most recently used tags’ is closed to new replies.