Forums Forums Search & Filter Pro Two identical taxonomies are displayed

Viewing 2 posts - 11 through 12 (of 12 total)
  • Ross Moderator
    #171374

    Hi there

    I figured the solution.

    Your theme has this function _st_list_categories_without_title, which, it seems to (unintentionally perhaps) filter every single wp_list_categories

    I don’t understand the logic of the function, but they seem to destroy and recreate the taxonomy list for perhaps a particular style of formatting.

    Anyway, we use that function in our plugin, and it caused some errors because we use the walker argument with wp_list_categories.

    I managed to figure a workaround though, which is to remove the walker setting from your themes _st_list_categories_without_title function.

    You can override their function (and use my modification) by adding this to your child theme-

    function _st_list_categories_without_title( $output, $args ) {
    	$defaults = array(
    		'echo'               => 0,
    		'use_desc_for_title' => 0,
    	);
    
    	$r = wp_parse_args( $args, $defaults );
    
    	$r['use_desc_for_title'] = 0;
    	$r['echo']               = 0;
    	$r['walker']             = ''; //this is the only change I made
    
    	remove_filter( 'wp_list_categories', __FUNCTION__, 11 );
    	
    	$output = wp_list_categories( $r );
    
    	add_filter( 'wp_list_categories', '_st_list_categories_without_title', 11, 2 );
    
    	return $output;
    }

    I’m not sure if it will have unintended consequences in your theme though (and I’m sure this filter needs to be applied conditionally rather than globally), so it would be best to direct your theme author to this post – I would be happy to discuss with them this code and my suggestion.

    Thanks

    Anonymous
    #171392
    This reply has been marked as private.
Viewing 2 posts - 11 through 12 (of 12 total)