-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a41cc6e
commit b0c7375
Showing
2 changed files
with
60 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
defined( 'ABSPATH' ) OR exit; | ||
|
||
class WCMF_walker extends Walker_CategoryDropdown | ||
{ | ||
var $tree_type = 'category'; | ||
var $db_fields = array( | ||
'parent' => 'parent' | ||
,'id' => 'term_id' | ||
); | ||
public $tax_name; | ||
|
||
/** | ||
* @see Walker::start_el() | ||
* @param string $output Passed by reference. Used to append additional content. | ||
* @param object $term Taxonomy term data object. | ||
* @param int $depth Depth of category. Used for padding. | ||
* @param array $args Uses 'selected' and 'show_count' keys, if they exist. | ||
* @param int $id | ||
* @return void | ||
*/ | ||
function start_el( &$output, $term, $depth, $args, $id = 0 ) | ||
{ | ||
$pad = str_repeat( ' ', $depth * 3 ); | ||
$cat_name = apply_filters( 'list_cats', $term->name, $term ); | ||
$output .= sprintf( | ||
'<option class="level-%s" value="%s" %s>%s%s</option>' | ||
,$depth | ||
,$term->slug | ||
,selected( | ||
$args['selected'] | ||
,$term->slug | ||
,false | ||
) | ||
,"{$pad}{$cat_name}" | ||
,$args['show_count'] | ||
? " ({$term->count})" | ||
: '' | ||
); | ||
} | ||
} |