Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Does this do what you want?:

    $term->name = str_repeat('- ',$depth).$term->name.' ('.$term->count.')';

    But, that won’t work if you have sub-sub cats, where you just want one dash even when a cat is 2 or more deep.

    Oh! My original code should have &-n-b-s-p-; where it shows a space. But, it doesn’t show. I just noticed that.

    Ted,

    Whatever character you want for the indent, put in place of the ‘ ‘ in this line in my code:
    $term->name = str_repeat(‘ ‘,$depth*4).$term->name.’ (‘.$term->count.’)’;

    If you want a dash, use:
    $term->name = str_repeat(‘-‘,$depth*4).$term->name.’ (‘.$term->count.’)’;

    +1 for this feature.

    I made the category drop-down hierarchical, with counts for categories and tags, with these mods to template.php:

    Look for:
    # Taxonomy dropdown:

    Replace the $terms = get_terms… with:

    $terms = get_terms( $key, array(
    	'hide_empty' => true,
    	'pad_counts' => true
    ) );
    sort_terms_hierarchy($terms);

    Then add this sort_terms_hierarchy function somewhere:

    function sort_terms_hierarchy(Array &$terms) {
    	$result = array();
    	$parent = 0;
    	$depth = 0;
    	$i = 0;
    	do {
    		$temp = array();
    		foreach($terms as $j => $term) {
    			if ($term->parent == $parent) {
    				$term->depth = $depth;
    				$term->name = str_repeat(' ',$depth*4).$term->name.' ('.$term->count.')';
    				array_push($temp, $term);
    				unset($terms[$j]);
    			}
    		}
    		array_splice($result, $i, 0, $temp);
    		$parent = $result[$i]->term_id;
    		$depth = $result[$i]->depth + 1;
    	} while ($i++ < count($result));
    	$terms = $result;
    }
    Thread Starter tbird12

    (@tbird12)

    The fault is with WPSearch, not Facetious. WPSearch doesn’t handle categories correctly, and doesn’t support tags at all. So, I had to remove WPSearch.

    Thread Starter tbird12

    (@tbird12)

    Can you explain how and where in the php that Facetious hooks in to the search function?

Viewing 6 replies - 1 through 6 (of 6 total)