Im really struggling to piece this functionality together, and hope someone can help or provide snippets to get me there.
So I’m creating a section on a website where stories are published, I have created a custom post type for the stories section and taxonomies for the story types (category) and story tags (the tags). Everything is working fine and displaying correctly in that respect.
Heres the setup details:
- Custom Post Type: stories
- Custom Taxonomy (the category): story-type
- Custom Taxonomy (the tags): story-tags
I need to be able to filter posts on a landing page by 4x options:
- Story Type Taxonomy (Chapter or Extract, Featured, Flash Fiction,
Micro Fiction, Poem, Short Story) - Story Tags Taxonomy (Debut, Funny, True Story)
- by Month (jan, feb, march, etcâ¦)
- Sort by (most read, most recent)
So an example: Please show me all Fiction stories tagged funny in June and sort them by most read.
I’m not fussy where the results are displayed as long as they are accurate.
The results page would then be titled “Your Results”
Thanks for your time so far…
I would take a look at this page on the Codex:
http://codex.wordpress.org/Class_Reference/WP_Query
I think you need to override your query_posts() for your landing page, and controlling different queries with if() statements, depending on what areas of a form (guessing you’re using a form?) has filled in. For example:
The sorting is done in the same way – check out ‘order’ and ‘orderby’.
You’ll probably want to ignore this answer. I read the question completely wrong.
You’ll be needing the tax_query inside a WP_Query. There’s examples under the Taxonomy Parameters section on the WP_Query docs on Codex.
An example (taken from Codex) of searching multiple taxonomies: