Skip to content

Instantly share code, notes, and snippets.

@jauhari
Created February 5, 2017 08:21
Show Gist options
  • Save jauhari/f1d080c3667c272f5926d6f930d8cd58 to your computer and use it in GitHub Desktop.
Save jauhari/f1d080c3667c272f5926d6f930d8cd58 to your computer and use it in GitHub Desktop.
/*-----------------------------------------------------------------------------------*/
/* Breadcrumbs
/*-----------------------------------------------------------------------------------*/
if (!function_exists('redwaves_breadcrumb')) {
function redwaves_breadcrumb() {
echo '<div><i class="fa fa-home"></i></div> <div typeof="v:Breadcrumb" class="root"><a rel="v:url" property="v:title" href="';
echo home_url();
echo '">'.sprintf( __( "Home","redwaves-lite"));
echo '</a></div><div>'.__('<i class="fa fa-caret-right"></i>','redwaves-lite').'</div>';
if (is_category() || is_single()) {
$categories = get_the_category();
$output = '';
if($categories){
echo '<div typeof="v:Breadcrumb"><a href="'.get_category_link( $categories[0]->term_id ).'" rel="v:url" property="v:title">'.$categories[0]->cat_name.'</a></div><div>'.__('<i class="fa fa-caret-right"></i>','redwaves-lite').'</div>';
}
if (is_single()) {
echo "<div typeof='v:Breadcrumb'><span property='v:title'>";
the_title();
echo "</span></div>";
}
} elseif (is_page()) {
echo "<div typeof='v:Breadcrumb'><span property='v:title'>";
the_title();
echo "</span></div>";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment