Skip to content

Instantly share code, notes, and snippets.

@zexeder
Last active August 29, 2015 14:19
Show Gist options
  • Save zexeder/eac03b6124bab018266d to your computer and use it in GitHub Desktop.
Save zexeder/eac03b6124bab018266d to your computer and use it in GitHub Desktop.
Хлебные крошки
<?php
function the_breadcrumb() {
echo '<div id="breadcrumb"><ul><li><a href="/">Главная</a></li><li>></li>';
if ( is_category() || is_single() ) {
$cats = get_the_category();
$cat = $cats[0];
echo '<li><a href="'.get_category_link($cat->term_id).'">'.$cat->name.'</a></li><li>></li>';
}
if(is_single()){
echo '<li>';
the_title();
echo '</li>';
}
if(is_page()){
echo '<li>';
the_title();
echo '</li>';
}
echo '</ul><div class="clear"></div></div>';
}
?>
#breadcrumb {
border-bottom: 1px solid #aaa;
margin-bottom: 10px;
}
#breadcrumb li{
list-style:none;
display:inline-block;
margin-left: 0px;
margin-right: 5px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment