WordPress.org

Ready to get started?Download WordPress

Forums

Filter Tag Archive by Custom Field (3 posts)

  1. ReidTheMindsChewToy
    Member
    Posted 6 years ago #

    Hello,

    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.

  2. MichaelH
    Member
    Posted 6 years ago #

    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

  3. ReidTheMindsChewToy
    Member
    Posted 6 years ago #

    Hello,

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic