Yoast Breadcrumbs Configuration

"sep", "label" => __('Separator between breadcrumbs'), "content" => '', ); $rows[] = array( "id" => "home", "label" => __('Anchor text for the Homepage'), "content" => '', ); $rows[] = array( "id" => "blog", "label" => __('Anchor text for the Blog'), "content" => '', ); $rows[] = array( "id" => "prefix", "label" => __('Prefix for the breadcrumb path'), "content" => '', ); $rows[] = array( "id" => "archiveprefix", "label" => __('Prefix for Archive breadcrumbs'), "content" => '', ); $rows[] = array( "id" => "searchprefix", "label" => __('Prefix for Search Page breadcrumbs'), "content" => '', ); $rows[] = array( "id" => "singlecatprefix", "label" => __('Show category in post breadcrumbs?'), "desc" => __('Shows the category inbetween Home and the blogpost'), "content" => '', ); $rows[] = array( "id" => "singleparent", "label" => __('Show Parent Page for Blog posts'), "desc" => __('Adds another page inbetween Home and the blogpost'), "content" => wp_dropdown_pages("echo=0&depth=0&name=singleparent&show_option_none=-- None --&selected=".$opt['singleparent']), ); $rows[] = array( "id" => "boldlast", "label" => __('Bold the last page in the breadcrumb'), "content" => '', ); $rows[] = array( "id" => "nofollowhome", "label" => __('Nofollow the link to the home page'), "content" => '', ); $rows[] = array( "id" => "trytheme", "label" => __('Try to add automatically'), "desc" => __('If you\'re using Hybrid, Thesis or Thematic, check this box for some lovely simple action'), "content" => '', ); $table = $this->form_table($rows); $this->postbox('breadcrumbssettings',__('Setting for Yoast Breadcrumbs'), $table.'
') ?>
plugin_like(); $this->plugin_support(); $this->news(); ?>



'.$input.''; } else { return $input; } } } if (!function_exists('yoast_get_category_parents')) { // Copied and adapted from WP source function yoast_get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){ $chain = ''; $parent = &get_category($id); if ( is_wp_error( $parent ) ) return $parent; if ( $nicename ) $name = $parent->slug; else $name = $parent->cat_name; if ( $parent->parent && ($parent->parent != $parent->term_id) ) $chain .= get_category_parents($parent->parent, true, $separator, $nicename); $chain .= bold_or_not($name); return $chain; } } $nofollow = ' '; if ($opt['nofollowhome']) { $nofollow = ' rel="nofollow" '; } $on_front = get_option('show_on_front'); if ($on_front == "page") { $homelink = ''.$opt['home'].''; $bloglink = $homelink.' '.$opt['sep'].' '.$opt['blog'].''; } else { $homelink = ''.$opt['home'].''; $bloglink = $homelink; } if ( ($on_front == "page" && is_front_page()) || ($on_front == "posts" && is_home()) ) { $output = bold_or_not($opt['home']); } elseif ( $on_front == "page" && is_home() ) { $output = $homelink.' '.$opt['sep'].' '.bold_or_not($opt['blog']); } elseif ( !is_page() ) { $output = $bloglink.' '.$opt['sep'].' '; if ( ( is_single() || is_category() || is_tag() || is_date() || is_author() ) && $opt['singleparent'] != false) { $output .= ''.get_the_title($opt['singleparent']).' '.$opt['sep'].' '; } if (is_single() && $opt['singlecatprefix']) { $cats = get_the_category(); $cat = $cats[0]; if ( is_object($cat) ) { if ($cat->parent != 0) { $output .= get_category_parents($cat->term_id, true, " ".$opt['sep']." "); } else { $output .= ''.$cat->name.' '.$opt['sep'].' '; } } } if ( is_category() ) { $cat = intval( get_query_var('cat') ); $output .= yoast_get_category_parents($cat, false, " ".$opt['sep']." "); } elseif ( is_tag() ) { $output .= bold_or_not($opt['archiveprefix']." ".single_cat_title('',false)); } elseif ( is_date() ) { $output .= bold_or_not($opt['archiveprefix']." ".single_month_title(' ',false)); } elseif ( is_author() ) { $user = get_userdatabylogin($wp_query->query_vars['author_name']); $output .= bold_or_not($opt['archiveprefix']." ".$user->display_name); } elseif ( is_search() ) { $output .= bold_or_not($opt['searchprefix'].' "'.stripslashes(strip_tags(get_search_query())).'"'); } else if ( is_tax() ) { $taxonomy = get_taxonomy ( get_query_var('taxonomy') ); $term = get_query_var('term'); $output .= $taxonomy->label .': '.bold_or_not( $term ); } else { $output .= bold_or_not(get_the_title()); } } else { $post = $wp_query->get_queried_object(); // If this is a top level Page, it's simple to output the breadcrumb if ( 0 == $post->post_parent ) { $output = $homelink." ".$opt['sep']." ".bold_or_not(get_the_title()); } else { if (isset($post->ancestors)) { if (is_array($post->ancestors)) $ancestors = array_values($post->ancestors); else $ancestors = array($post->ancestors); } else { $ancestors = array($post->post_parent); } // Reverse the order so it's oldest to newest $ancestors = array_reverse($ancestors); // Add the current Page to the ancestors list (as we need it's title too) $ancestors[] = $post->ID; $links = array(); foreach ( $ancestors as $ancestor ) { $tmp = array(); $tmp['title'] = strip_tags( get_the_title( $ancestor ) ); $tmp['url'] = get_permalink($ancestor); $tmp['cur'] = false; if ($ancestor == $post->ID) { $tmp['cur'] = true; } $links[] = $tmp; } $output = $homelink; foreach ( $links as $link ) { $output .= ' '.$opt['sep'].' '; if (!$link['cur']) { $output .= ''.$link['title'].''; } else { $output .= bold_or_not($link['title']); } } } } if ($opt['prefix'] != "") { $output = $opt['prefix']." ".$output; } if ($display) { echo $prefix.$output.$suffix; } else { return $prefix.$output.$suffix; } } function yoast_breadcrumb_output() { $opt = get_option('yoast_breadcrumbs'); if ($opt['trytheme']) yoast_breadcrumb('
','
'); return; } add_action('thesis_hook_before_content','yoast_breadcrumb_output',10,1); add_action('hybrid_before_content','yoast_breadcrumb_output',10,1); add_action('thematic_belowheader','yoast_breadcrumb_output',10,1); add_action('framework_hook_content_open','yoast_breadcrumb_output',10,1); ?>