Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ( !function_exists( 'saaspool_breadcrumbs' ) ):
- function saaspool_breadcrumbs() {
- global $post;
- echo '<ul class="breadcrumbs">';
- if (!is_home()) {
- echo '<li><a href="';
- echo get_option('home');
- echo '">';
- echo 'Home';
- echo '</a></li><li class="breadcrumb-item"> / </li>';
- if (is_category() || is_single()) {
- echo '<li>';
- the_category(' </li><li class="breadcrumb-item"> / </li><li> ');
- if (is_single()) {
- echo '</li><li class="breadcrumb-item"> / </li><li>';
- the_title();
- echo '</li>';
- }
- } elseif (is_page()) {
- if($post->post_parent){
- $anc = get_post_ancestors( $post->ID );
- $title = get_the_title();
- foreach ( $anc as $ancestor ) {
- $output = '<li><a href="'.get_permalink($ancestor).'" title="'.get_the_title($ancestor).'">'.get_the_title($ancestor).'</a></li> <li class="breadcrumb-item">/</li>';
- }
- echo $output;
- echo ''.$title.'';
- } else {
- echo '<li>'.get_the_title().'</li>';
- }
- }
- }
- elseif (is_tag()) {single_tag_title();}
- elseif (is_day()) {echo"<li>Archive for "; the_time('F jS, Y'); echo'</li>';}
- elseif (is_month()) {echo"<li>Archive for "; the_time('F, Y'); echo'</li>';}
- elseif (is_year()) {echo"<li>Archive for "; the_time('Y'); echo'</li>';}
- elseif (is_author()) {echo"<li>Author Archive"; echo'</li>';}
- elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "<li>Blog Archives"; echo'</li>';}
- elseif (is_search()) {echo"<li>Search Results"; echo'</li>';}
- echo '</ul>';
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement