how to create breadcrumbs using wordpress nav menu without plugin?

trying to show breadcrumbs but i am stuck.

ABOUT US 
 - TEAM
 - WHAT WE DO

i don’t understand how to show all menus dynamically in breadcrumbs, if i am currently on what we do page then how to show in breadcrumbs kindly help me

Read More

i try this

<?php $menuID = $post->ID;
query_posts( 'post_type=page&post_parent=$menuID' );
while ( have_posts() ) : the_post();
the_title();
endwhile;
?>

this code just show child of every page but how can i find page which one is clicked

Related posts

Leave a Reply

1 comment

  1. Place this code in custom_functions.php:

        function the_breadcrumb() {
        global $post;
        echo '<ul id="breadcrumbs">';
        if (!is_home()) {
            echo '<li><a href="';
            echo get_option('home');
            echo '">';
            echo 'Home';
            echo '</a></li><li class="separator"> / </li>';
            if (is_category() || is_single()) {
                echo '<li>';
                the_category(' </li><li class="separator"> / </li><li> ');
                if (is_single()) {
                    echo '</li><li class="separator"> / </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="separator">/</li>';
                    }
                    echo $output;
                    echo '<strong title="'.$title.'"> '.$title.'</strong>';
                } else {
                    echo '<li><strong> '.get_the_title().'</strong></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>';
    }
    

    Go to your single.php page and add the following code anywhere you want to display the breadcrumbs.

    <?php the_breadcrumb(); ?>