• To display a single taxonomie filtering in my headline, I use ‘<?php single_cat_title(); ?>’ in the archive.php. But if I choose from more than one dropdown lists in the filter, which function should I use to display all the selected criteria?

    Example:

    select dropdown-list-1, criterion-1
    +
    select dropdown-list-2, criterion-2

    execute filter

    Show on archive.php i.e.: “Selected: criterion-1 & criterion-2”

    Thanks for Your help!

    https://wordpress.org/plugins/beautiful-taxonomy-filters/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jonathandejong

    (@jonathandejong)

    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

    Plugin Author Jonathandejong

    (@jonathandejong)

    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 */
    }

    Plugin Author Jonathandejong

    (@jonathandejong)

    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)

    Plugin Author Jonathandejong

    (@jonathandejong)

    Hi Macbo,

    They should use the same code but I’ll have a look just to make sure 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display all filtering criteria in the headline of result page’ is closed to new replies.