How can I add breadcrumb to my Themia theme?

Discussion in 'Themia WordPress Theme' started by tdstartupto2015, Feb 15, 2015.

  1. tdstartupto2015

    tdstartupto2015 New Member

    Joined:
    Feb 11, 2015
    Messages:
    5
    Likes Received:
    0
    Hi, how can I add breadcrumbs to the Themia theme?
     
  2. Pramod

    Pramod Guest

    Joined:
    Aug 8, 2014
    Messages:
    2,847
    Likes Received:
    63
    Hello,

    Step 1: Put below code in functions.php file at last.
    PHP:
    <?php
    function the_breadcrumbs() {
     
            global 
    $post;
     
            if (!
    is_home()) {
     
                echo 
    "<a href='";
                echo 
    get_option('home');
                echo 
    "'>";
                echo 
    "Home";
                echo 
    "</a>";
     
                if (
    is_category() || is_single()) {
     
                    echo 
    " > ";
                    
    $cats get_the_category$post->ID );
     
                    foreach ( 
    $cats as $cat ){
                        echo 
    $cat->cat_name;
                        echo 
    " > ";
                    }
                    if (
    is_single()) {
                        
    the_title();
                    }
                } elseif (
    is_page()) {
     
                    if(
    $post->post_parent){
                        
    $anc get_post_ancestors$post->ID );
                        
    $anc_link get_page_link$post->post_parent );
     
                        foreach ( 
    $anc as $ancestor ) {
                            
    $output " > <a href=".$anc_link.">".get_the_title($ancestor)."</a> > ";
                        }
     
                        echo 
    $output;
                        
    the_title();
     
                    } else {
                        echo 
    ' > ';
                        echo 
    the_title();
                    }
                }
            }
        elseif (
    is_tag()) {single_tag_title();}
        elseif (
    is_day()) {echo"Archive: "the_time('F jS, Y'); echo'</li>';}
        elseif (
    is_month()) {echo"Archive: "the_time('F, Y'); echo'</li>';}
        elseif (
    is_year()) {echo"Archive: "the_time('Y'); echo'</li>';}
        elseif (
    is_author()) {echo"Author's archive: "; echo'</li>';}
        elseif (isset(
    $_GET['paged']) && !empty($_GET['paged'])) {echo "Blogarchive: "; echo'';}
        elseif (
    is_search()) {echo"Search results: "; }
    }
    ?>
    Step 2: Put below code in page.php, single.php etc.
    PHP:
      <div class="theme_breadcrumb">
      <?php if(function_exists('the_breadcrumbs')) the_breadcrumbs(); ?>
      </div>
    rethink-breadcrumb-16-feb.png
    Thanks & Regards
    Pramod Patel
     

Share This Page