-
-
Save johnheimkes/4626626 to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* My Project | |
* | |
* @package MyProject | |
* @subpackage JesGs_Walker_Category | |
* @author Jess Green <[email protected]> | |
* @version $Id$ | |
*/ | |
/** | |
* JesGs_Walker_Category | |
* | |
* @package JesGs_Walker_Category | |
* @author Jess Green <[email protected]> | |
*/ | |
class JesGs_Walker_Category extends Walker_Category | |
{ | |
/** | |
* @see Walker_Category::end_lvl | |
*/ | |
public function start_lvl(&$output, $depth = 0, $args = array()) | |
{ | |
parent::start_lvl($output, $depth, $args); | |
} | |
/** | |
* @see Walker_Category::end_lvl | |
*/ | |
public function end_lvl(&$output, $depth = 0, $args = array()) | |
{ | |
parent::end_lvl($output, $depth, $args); | |
} | |
/** | |
* @see Walker_Category::start_el | |
*/ | |
public function start_el(&$output, $category, $depth, $args, $current_object_id = 0) | |
{ | |
extract($args); | |
$cat_name = esc_attr( $category->name ); | |
$cat_name = apply_filters( 'list_cats', $cat_name, $category ); | |
$cat_slug = esc_attr( $category->slug ); | |
if ( 'list' == $args['style'] ) { | |
$output .= "\t<li"; | |
$class = 'cat-item cat-item-' . $category->term_id; | |
if ( !empty($current_category) ) { | |
$_current_category = get_term( $current_category, $category->taxonomy ); | |
if ( $category->term_id == $current_category ) | |
$class .= ' current-cat'; | |
elseif ( $category->term_id == $_current_category->parent ) | |
$class .= ' current-cat-parent'; | |
} | |
$output .= ' class="' . $class . '"'; | |
$output .= "><input type=\"checkbox\" name=\"$cat_slug\" /> $cat_name"; | |
} else { | |
$output .= "\t$cat_name<br />\n"; | |
} | |
} | |
/** | |
* @see Walker_Category::end_el | |
*/ | |
public function end_el(&$output, $object, $depth = 0, $args = array()) | |
{ | |
parent::end_el($output, $object, $depth, $args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment