I figured out I can filter posts by format just by doing /type/{format} e.g. /type/gallery/ in the url.
Looking for a way to filter by categories on top of this, something like /type/gallery/category/installation or /type/gallery/art.
I’ve figured out the query, but I don’t know how to handle the url bit:
$galleryquery = wp_parse_args($query_string);
$galleryquery['tax_query'] = array(
array(
'taxonomy' => 'post_format',
'terms' => array('post-format-gallery'),
'field' => 'slug',
),
array(
'taxonomy' => 'category',
'terms' => array('installation'),
'field' => 'slug',
),
);
query_posts($galleryquery);
Ideas? I’m guessing I have to intercept the permalink and somehow pass it to my query…
Site is reachable here
I am doing something similar, but for member pages. I was able to use the code in my answer linked here which parses the information in the URL which can be manipulated within WordPress.
https://wordpress.stackexchange.com/a/91399/12920
Here’s a snippet of the URL handling portion which perhaps will get you started? Granted you’re doing something different than me, but the underlying function should be very similar.
A possible approach is to create a new rewrite rule to handle the custom url. I haven’t tested the code, but it goes something like this:
Then you would access the new variable like so:
I ended up with this:
There is no need to add new query vars. You can get both taxonomies out of the box: categories are query-able with “?category_name=x” and post formats with “?post_format=x”.
Confusingly, post formats are a taxonomy, and not a custom post type, yet have the taxonomy of “type”. E.g. you filter them like so:
Seems like “/format/” would be a better taxonomy to avoid confusion with Custom Post Type.