/**
  * Start the element output.
  *
  * @see Walker::start_el()
  *
  * @param string Passed by reference. Used to append additional content.
  * @param object Taxonomy data object.
  * @param int    Depth of category in reference to parents. Default 0.
  * @param array  An array of arguments. @see wp_list_categories()
  * @param int    ID of the current category.
  */
 function start_el(&$output, $taxonomy_object, $depth = 0, $args = array(), $id = 0)
 {
     if (isset($this->mla_terms[$taxonomy_object->term_taxonomy_id])) {
         $taxonomy_object->count = $this->mla_terms[$taxonomy_object->term_taxonomy_id];
     }
     parent::start_el($output, $taxonomy_object, $depth, $args, $id);
 }
 /**
  * Code that appends posts when a child node is reached
  */
 function end_el(&$output, $object, $depth = 0, $args = array())
 {
     $tax_name = $args['taxonomy'];
     // use cat_id for category and slug for all other taxonomy
     $term_id = $tax_name == 'category' ? $object->cat_ID : $object->slug;
     $query_args = array('post_type' => $args['post_type'], 'post_status' => 'publish', 'posts_per_page' => -1, "{$tax_name}" => $term_id, 'meta_query' => array('relation' => 'OR', array('key' => WPSEO_Meta::$meta_prefix . 'meta-robots-noindex', 'value' => '', 'compare' => 'NOT EXISTS'), array('key' => WPSEO_Meta::$meta_prefix . 'meta-robots-noindex', 'value' => '1', 'compare' => '!='), array('key' => WPSEO_Meta::$meta_prefix . 'sitemap-html-include', 'value' => 'always', 'compare' => '=')));
     $posts = get_posts($query_args);
     if (is_array($posts) && $posts !== array()) {
         $output .= '<ul>';
         foreach ($posts as $post) {
             $category = get_the_terms($post->ID, $tax_name);
             if ($category) {
                 // reset array to get the first element
                 $category = reset($category);
                 // Only display a post link once, even if it's in multiple taxonomies
                 if ($category->term_id == $object->term_id && !in_array($post->ID, $this->processed_post_ids)) {
                     $this->processed_post_ids[] = $post->ID;
                     $output .= '<li><a href="' . esc_url(get_permalink($post->ID)) . '">' . get_the_title($post->ID) . '</a></li>';
                 }
             }
         }
         $output .= '</ul>';
     }
     parent::end_el($output, $object, $depth, $args);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     /*$display = false;
     
     		$id = $element->term_id;
     
     		$display = true;
     		if ( isset( $children_elements[ $id ] ) ) {
     			// the current term has children
     			foreach ( $children_elements[ $id ] as $child ) {
     				if ( in_array( $child->term_id, $this->term_ids ) ) {
     					// one of the term's children is in the list
     					$display = true;
     					// can stop searching now
     					break;
     				}
     			}
     		}
     
     		if ( $display )*/
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 /**
  * Traverse elements to create list from elements.
  *
  * Display one element if the element doesn't have any children otherwise,
  * display the element and its children. Will only traverse up to the max
  * depth and no ignore elements under that depth.
  *
  * This method shouldn't be called directly, use the walk() method instead.
  *
  * @see Walker::start_el()
  * @since 2.5.0
  *
  * @param object $element Data object
  * @param array $children_elements List of elements to continue traversing.
  * @param int $max_depth Max depth to traverse.
  * @param int $depth Depth of current element.
  * @param array $args
  * @param string $output Passed by reference. Used to append additional content.
  * @return null Null on failure with no changes to parameters.
  */
 public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
 {
     if (!$element) {
         return;
     }
     $id_field = $this->db_fields['id'];
     // Display this element.
     if (is_object($args[0])) {
         $args[0]->has_children = !empty($children_elements[$element->{$id_field}]);
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
 public function start_el(&$output, $category, $depth, $args)
 {
     parent::start_el($output, $category, $depth, $args);
     $find = 'cat-item-' . $category->term_id . '"';
     $replace = $category->slug . '"';
     $output = str_replace($find, $replace, $output);
 }