Bricks 2.0 & Chrome Version 137.0.7151.120
I have a map element with a query loop that is displaying posts from two post types: research-center & reseach-lab. I added a search filter to top it off, and this setup works fine:
Both post types are associated with the taxonomy “vib-science-topic”. Because it’d be great if people could also find labs/centers when they search by topic I thought I’d add a taxonomy query, but I just can’t get it to work.
I tried using the Bricks UI for a taxonomy query first, with these settings:
- Taxonomy: [here I select the vib science topic taxonomy]
- field: slug
- terms: {get:brx_xxsrxo}
- compare: IN
As soon as I save that, my result list is empty, even if I don’t enter any term.
I then tried adding this in the PHP query editor:
$term_slug = $_GET['brx_xxsrxo'] ?? '';
$args = [
'posts_per_page' => 10,
'offset' => 0,
'post_type' => ['research-center', 'research-lab'],
'order' => 'ASC',
'orderby' => 'title',
];
// Voeg taxonomy query toe als er een slug is
if (!empty($term_slug)) {
$args['tax_query'] = [
[
'taxonomy' => 'vib-science-topic',
'field' => 'slug',
'terms' => $term_slug,
'compare' => 'LIKE',
'include_children' => true,
]
];
}
return $args;
Now I see the posts, but as soon as I enter a topic like “neuroscience” I get zero results again, even if at least two posts are really associated with the term “neuroscience”:
The dev page for this is https://staging-gb.instawp.xyz/contact/ (it’s now using the PHP query loop).
Am I missing something? This shouldn’t be too hard, I suppose, but I still can’t seem to make it work. Can someone shed a professional light on this -something that I could perhaps try? I’d honestly really appreciate it.
Kind regards,
Geert