Hi Macbo,
Yes that works fine if you’re on just a single taxonomy filtering. What you need to do is a check wether you have more than one in your global $wp_query object and if so loop through them all and output them accordingly.
For a bit more handson example you can have a look at how I’ve solved creating customized seo title and descriptions with SEO By Yoast with multiple taxonomy filters.
https://gist.github.com/jonathan-dejong/05d2118a84fc7bc2f684
If you just want to display the current filtering you can also use the filter info module included in the plugin 🙂
Thread Starter
macbo
(@macbo)
Hi Jonathan,
thank You for both hints!
My PHP knowledge isn’t high enough, so I’ve built a work around with CSS for your filter info module. This works fine, but still there is a minor problem while showing the result: all not chosen drop down-lists show their name without showing “all” in front of it. Exception: the last drop down shows it in the correct way.
Do You have an idea?
Here’s my CSS work around:
.beautiful-taxonomy-filters-active-filter {
display: inline;
}
.beautiful-taxonomy-filters-info-heading {
display: inline;
}
.beautiful-taxonomy-filters-postcount {
display: none;
}
.beautiful-taxonomy-filters-single-tax {
display: inline;
}
.single-tax-key {
display: none;
}
.single-tax-value:before {
content: "bs0020 bs00BB bs0020";
/* it should be "backslash0020backslash00BBbackslash0020"
this represents " » ", thanks to
https://css-tricks.com/css-content/ and
http://www.evotech.net/articles/testjsentities.html */
}
All the text comes from the labels you’ve set in registering the taxonomies. So if you make sure you have set the “All <taxonomy>” label properly they will turn up 🙂
Thread Starter
macbo
(@macbo)
Sorry, maybe I wasn’t precise enough…
In my archive.php I use your function “show_beautiful_filters_info()” to display my headline using the work around I described above. In my sidebar I use Your widget for filtering.
The sidebar widget is displaying correctly: ‘all taxonomy’ if nothing is chosen.
But the info-function is only displaying the last ‘all taxonomy’ in the right way. The others show only ‘taxonomy’ without “all’ in front of them, when not chosen.
I asume, there is a slightly different code inside that is responsible for displaying the results in a different way.
Example 1:
Sidebar displays in Sidebar displays in info
tax1 - nothing all tax1 something
tax2 - nothing all tax2 tax1 (without 'all')
tax3 - something something tax2 (without 'all')
Example 2:
Sidebar displays in Sidebar displays in info
tax1 - nothing all tax1 something
tax2 - something something tax1 (without 'all')
tax3 - nothing all tax3 all tax3 (with 'all')
To sum up: tax3 always works correct, tax1 and tax2 don’t.
Thanks for Your excellent plugin! Now I have about 120 articles with 3 taxonomies to filter and it works really fine ;o)
Hi Macbo,
They should use the same code but I’ll have a look just to make sure 🙂