Support » Plugins and Hacks » Filter Tag Archive by Custom Field

Filter Tag Archive by Custom Field

  • ReidTheMindsChewToy



    For movie reviews on my site, one of the custom fields I have set up is “release” for the date the movie was released.

    For these same reviews, I have tags for the various actors in the film (example: Samuel L Jackson).

    My question: how would I sort the posts on the tag archive page for a particular actor (tag/samuel-l-jackson) by my movie release date custom field (similar to a filmography)? Since I review both new and older films, they are not always already in that order.

    I’ve seen a couple examples on here on how to sort by custom field, but am not sure how to include the tag in the query.

    As my tags are quite extensive by this point (about 3,000), I would much prefer to use a tag Tag Archive page for this, rather than setting up a seperate tag page for each actor (or using “If, Then” statements).

    Basically, how do I add a “generic” tag query to the code mentioned on http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query ?

    Any help on this would be greatly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • MichaelH


    When you display each post and use the Template Tag, the tags(), to display the tags, then when a user clicks on one of those tags it will automatically show you a tag archive page with all the posts that have that particular tag.

    See: Template Hierarchy




    Thanks for replying.

    I am using a Tag Template Page already to display the posts with a particular tag.

    My question is how to sort those tagged posts by a custom field rather than chronologically.

    Thanks for your continued help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter Tag Archive by Custom Field’ is closed to new replies.
Skip to toolbar