Support » Plugin: Beautiful taxonomy filters » Indent Sub-Category In Select Box

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


    Hi Darren,

    Thank you for those kind words! It’d be very nice if you would like to leave a review, it helps a lot!

    When using the select2 library the dropdown actually becomes an ul list with div tags inside. So making a cross-browser indentation with CSS should be fairly easy and is actually implemented in the packaged styles with the plugin. there’s a 10px padding-left on elements with the class level-1 (level-0 is root).

    Of course it’s a whole different story if you’ve disabled select2. Styling the regular dropdown is indeed a bitch 🙂

    I don’t want the plugin to assume anything about how the user want their dropdowns to look like. However I could add a filter to my custom walker function for wp_dropdown_categories() which would let you modify the category name however you like before it’s output.

    I’ll add it to my todo list! Thanks for the feedback

    Thanks for your reply. I should have said that I’m not using select2. A custom filter would be great 🙂

    Plugin Author Jonathandejong



    With version 1.2.5 (just released) you now have a filter to do this..
    Here’s an example function you can paste into your functions.php which’ll do pretty much what you want:

    //Add visual information when a terms are children/grandchildren etc.
    add_filter('beautiful_filters_term_name', 'custom_term_name', 10, 3);
    function custom_term_name($term_name, $category, $depth){
    	//We have indentation
    	if($depth !== 0){
    		$indent = '';
    		//Add one – for each step down the hierarchy, like WP does in admin.
    		for($i = 0; $i < $depth; $i++){
    			$indent .= '–';
    		return $indent . ' ' . $term_name;
    	return $term_name;

    That’s perfect! Thank you for providing the update so quickly.

    All I changed was the Unicode en dash

    $indent .= '&ndash;';

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Indent Sub-Category In Select Box’ is closed to new replies.