'', 'show_option_none' => __('No categories'), 'orderby' => 'name', 'order' => 'ASC', 'show_last_update' => 0, 'style' => 'list', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_type' => '', 'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'current_category' => 0, 'hierarchical' => true, 'title_li' => __( 'Categories' ), 'echo' => 1, 'depth' => 0, 'taxonomy' => 'category' ); $r = wp_parse_args( $args, $defaults ); if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) $r['pad_counts'] = true; if ( isset( $r['show_date'] ) ) $r['include_last_update_time'] = $r['show_date']; if ( true == $r['hierarchical'] ) { $r['exclude_tree'] = $r['exclude']; $r['exclude'] = ''; } if ( !isset( $r['class'] ) ) $r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy']; extract( $r ); if ( !taxonomy_exists($taxonomy) ) return false; $categories = get_categories( $r ); $output = ''; if ( $title_li && 'list' == $style ) $output = '
  • ' . $title_li . '
  • '; return $output; } /** * Create HTML list of categories, with unlinked parent categories. * Based on Walker_Category class from wp-includes/category-template.php * * @uses Walker */ class Walker_Category_Unlink_Parents extends Walker { var $tree_type = 'category'; var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); // Define six new member variables to hold the option settings, and the list of all term ids. var $option_dummy = 1; var $option_unlink_current = 0; var $option_remove_titles = 0; var $option_unlink_specified_only = 0; var $option_unlink_array = array(); var $all_terms = array(); // Define a constructor to load the option settings from the db, and initialize the term id list. function Walker_Category_Unlink_Parents( $taxonomy = 'category' ) { $unlink_options = get_option('ambrosite_unlink_parent_cats'); $this->option_dummy = is_null($unlink_options['dummy']) ? 1 : $unlink_options['dummy']; $this->option_unlink_current = $unlink_options['unlink_current']; $this->option_remove_titles = $unlink_options['remove_titles']; $this->option_unlink_specified_only = $unlink_options['unlink_specified_only']; if ( $unlink_options['excats'] ) $this->option_unlink_array = array_map( 'intval', explode(',', $unlink_options['excats']) ); $this->all_terms = get_terms( $taxonomy, array( 'hide_empty' => false, 'hierarchical' => true ) ); } function start_lvl(&$output, $depth, $args) { if ( 'list' != $args['style'] ) return; $indent = str_repeat("\t", $depth); $output .= "$indent\n"; } function start_el(&$output, $category, $depth, $args) { extract($args); $cat_name = esc_attr( $category->name ); $cat_name = apply_filters( 'list_cats', $cat_name, $category ); // Begin modified code $unlink_current = false; if ( $this->option_unlink_current && $category->term_id == $current_category ) $unlink_current = true; $link_open = 'term_id, $this->all_terms, $taxonomy) && !$this->option_unlink_specified_only || in_array($category->term_id, $this->option_unlink_array) || $unlink_current ) { if ( $this->option_dummy ) { $link_open = 'option_remove_titles ) { if ( $use_desc_for_title == 0 || empty($category->description) ) $link .= 'title="' . esc_attr( sprintf(__( 'View all posts filed under %s' ), $cat_name) ) . '"'; else $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"'; } $link .= '>'; $link .= $cat_name . $link_close; // End modified code if ( !empty($feed_image) || !empty($feed) ) { $link .= ' '; if ( empty($feed_image) ) $link .= '('; $link .= ''; $link .= ''; if ( empty($feed_image) ) $link .= ')'; } if ( !empty($show_count) ) $link .= ' (' . intval($category->count) . ')'; if ( !empty($show_date) ) $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp); if ( 'list' == $args['style'] ) { $output .= "\tterm_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 .= ">$link\n"; } else { $output .= "\t$link
    \n"; } } function end_el(&$output, $page, $depth, $args) { if ( 'list' != $args['style'] ) return; $output .= "\n"; } } function ambrosite_unlink_parent_cats_admin() { ?>

    Ambrosite Unlink Parent Categories - Options

    />

    If you uncheck this box, the plugin will unlink the parent categories by replacing the anchor tags with span tags. In some themes, this may cause problems with CSS styling. In order to fix this, you would need to add an additional selector to any rule that targets the anchor tags (see the plugin FAQ for more information). If you are not experienced in writing CSS selectors, then it is strongly recommended to stick with dummy links.

    />

    Unlink the current category, in addition to the parent categories.

    />

    Remove the title attribute from the links. Stops the tooltip from popping up when the mouse hovers over the menu items.

    You can specify which categories you want unlinked, using a comma-separated list of category IDs (example: 3,7,31). If you want only these categories to be unlinked, then check the box below.

    />