Title: Automatic X level deep breadcrumbs
Last modified: August 30, 2016

---

# Automatic X level deep breadcrumbs

 *  Resolved [allencg](https://wordpress.org/support/users/allencg/)
 * (@allencg)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/automatic-x-level-deep-breadcrumbs/)
 * Hello
 * I have been trying with this code to get the breadcrumbs to always show sufficient
   levels of breadcrumbs depending on the number of parents there are. So if the
   page is 4 levels deep it should show four links. Trouble is with this code I 
   can only get the current page and its first parent. If there is a third level
   I have been adding it manually into the template, but is there a clean way to
   do this automatically. Like with <?php while or something. I am an extreme novice,
   so do give me the full code if you can and I can back engineer it to work out
   the fix but more importantly know how to apply it.
 *     ```
       <p id="bread"><span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
       				<span class="breadcrumb"><a href="<?php echo get_permalink(28); ?>" itemprop="url"><span itemprop="title">Home</span></a></span> &raquo;</span>      
   
             <span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
             <span class="breadcrumb"><?php
       // if there is a parent, display the link
       $parent_title = get_the_title( $post->post_parent );
       if ( $parent_title != the_title( ' ', ' ', false ) ) {
       	echo '<a href="' . get_permalink( $post->post_parent ) . '" itemprop="url" title="' . $parent_title . '">' . $parent_title . '</a>';
       }
       // then go on to the current page link
       ?></span> &raquo;</span>
   
       			<span class="breadcrumb" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
                   <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" itemprop="url"><span itemprop="title"><?php the_title(); ?></span></a></span></p>
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [allencg](https://wordpress.org/support/users/allencg/)
 * (@allencg)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/automatic-x-level-deep-breadcrumbs/#post-6549831)
 * I managed a word-around by installing the Yoast breadcrumbs and it works a treat.
   No point reinventing the wheel.

Viewing 1 replies (of 1 total)

The topic ‘Automatic X level deep breadcrumbs’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [allencg](https://wordpress.org/support/users/allencg/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/automatic-x-level-deep-breadcrumbs/#post-6549831)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
