variables for this section $term_object = get_term($queried_object); $taxonomy = $term_object->taxonomy; $term_id = $term_object->term_id; $term_name = $term_object->name; $term_parent = $term_object->parent; $taxonomy_object = get_taxonomy($taxonomy); $current_term_link = $before . $taxonomy_object->labels->singular_name . ': ' . $term_name . $after; $parent_term_string = ''; if(0 !== $term_parent) { // Get all the current term ancestors $parent_term_links = []; while($term_parent) { $term = get_term($term_parent, $taxonomy); $parent_term_links[] = sprintf($link, esc_url(get_term_link($term)), $term->name); $term_parent = $term->parent; } $parent_term_links = array_reverse($parent_term_links); $parent_term_string = implode($delimiter, $parent_term_links); } if($parent_term_string) { $breadcrumb_trail = $parent_term_string . $delimiter . $current_term_link; } else { $breadcrumb_trail = $current_term_link; } } elseif(is_author()) { $breadcrumb_trail = __('Author archive for ', 'elementskit') . $before . $queried_object->data->display_name . $after; } elseif(is_date()) { // Set default variables $year = $wp_the_query->query_vars['year']; $monthnum = $wp_the_query->query_vars['monthnum']; $day = $wp_the_query->query_vars['day']; // Get the month name if $monthnum has a value if($monthnum) { $date_time = DateTime::createFromFormat('!m', $monthnum); $month_name = $date_time->format('F'); } if(is_year()) { $breadcrumb_trail = $before . $year . $after; } elseif(is_month()) { $year_link = sprintf($link, esc_url(get_year_link($year)), $year); $breadcrumb_trail = $year_link . $delimiter . $before . $month_name . $after; } elseif(is_day()) { $year_link = sprintf($link, esc_url(get_year_link($year)), $year); $month_link = sprintf($link, esc_url(get_month_link($year, $monthnum)), $month_name); $breadcrumb_trail = $year_link . $delimiter . $month_link . $delimiter . $before . $day . $after; } } elseif(is_post_type_archive()) { $post_type = $wp_the_query->query_vars['post_type']; $post_type_object = get_post_type_object($post_type); $breadcrumb_trail = $before . $post_type_object->labels->singular_name . $after; } } // Handle the search page if(is_search()) { $breadcrumb_trail = __('Search query for: ', 'elementskit') . $before . get_search_query() . $after; } // Handle 404's if(is_404()) { $breadcrumb_trail = $before . __('Error 404', 'elementskit') . $after; } // Handle paged pages if(is_paged()) { $current_page = get_query_var('paged') ? get_query_var('paged') : get_query_var('page'); $page_addon = $before . sprintf(__(' ( Page %s )', 'elementskit'), number_format_i18n($current_page)) . $after; } $breadcrumb_output_link = ''; $breadcrumb_output_link .= ''; return $breadcrumb_output_link; } } Visit the CSJT Store – Cheaper Flights App

Visit the CSJT Store

Showing the single result

Translate »