What are WordPress Breadcrumb?

11
24
1.3K followers

Wikipedia defines a breadcrumb as follows:

The graphical control element Breadcrumbs or breadcrumb trail is a navigation aid used in user interfaces. It allows users to keep track of their locations within programs or documents. The term comes from the trail of breadcrumbs left by Hansel and Gretel in the popular fairytale.

On websites that have a lot of pages, breadcrumb navigation can greatly enhance the way users find their way around. In terms of usability, breadcrumbs reduce the number of actions a website visitor needs to take in order to get to a higher-level page, and they improve the findability of website sections and pages. They are also an effective visual aid that indicates the location of the user within the website’s hierarchy, making it a great source of contextual information for landing pages.

Unfortunately plugins for simple functions within a WordPress installation are too often used. To answer to control this shortcoming, or perhaps rather the laziness a bit, I'm just doing my blogs to extract the juice a little and make plug-in free. In the following you’ll find a code that you can copy in your theme’s functions.php, that will generate a breadcrumb very simple and that you can use on any page (single.php, archiv.php etc.).

Modify your theme files only when you have some experience in Html and css coding, otherwise choose a theme with integrated breadcrumbs or use the below recommended plug in.

To integrate our new breadcrumb feature in our WordPress theme, you proceed as follows:

Modify the first functions.php

You go to appareance>Editor and open the functions.php and just copy the following code to the file:

<?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>';

}

?>

Then add to your header.php following code :

<?php the_breadcrumb(); ?>

Then add this to your Stysheet.css

#breadcrumbs{

list-style:none;

margin:10px 0;

overflow:hidden;

}

#breadcrumbs li{

float:left;

margin-right:15px;

}

#breadcrumbs .separator{

font-weight:700;

font-size:20px;

color:#999;

}

But for those of you who prefer not to go and change the files of your thème, there are some very good plugins like:

Breadcrumb NavXT -

https://wordpress.org/plugins/breadcrumb-navxt/

11
24

Join FREE & Launch Your Business!

Exclusive Bonus - Offer Ends at Midnight Today

00

Hours

:

00

Minutes

:

00

Seconds

2,000 AI Credits Worth $10 USD

Build a Logo + Website That Attracts Customers

400 Credits

Discover Hot Niches with AI Market Research

100 Credits

Create SEO Content That Ranks & Converts

800 Credits

Find Affiliate Offers Up to $500/Sale

10 Credits

Access a Community of 2.9M+ Members

By continuing, you agree to our Terms of Service and Privacy Policy
No credit card required

Recent Comments

24

Thank you for the information and coding. I am still learning how to use html coding but I'm slowly starting to understand.

Html and CSS are languages as others, but it is really not necessary to know to move forwards in Internet Marketing.

Thank you giludi, I will bookmark this for reference.
All the best,
Brandon

Thanks for you support. But please use a plugin if you don't have any experience in html - css coding.

1

thanks! I used the plugin!

this is mostly the best solution.

1

Interesting. Thank you for sharing.

thanks for your support.

1

I bookmark you for when I am a bit more certain from what I am doing, for now I stay away from editor stuff, I don't trust myself in that area yet, Loes

better don't touch at codes until you learned about. Use the plugin, it's mostly safer.

1

If you would like this topic explained in plain English here is my blog post on breadcrumbs for WordPress

https://my.wealthyaffiliate.com/bazboy247/blog/bread-crumbs-in-plain-english

Barry

1

yes, my friend.

I've been wondering about breadcrumbs for a while. Thanks for the illumination.

Great posting, Gliudi...

You have a deep insight in this field and its kind of you share your unique knowldege with the Community.

Thank you for all you do,
Jay Barnelli

Thanks for your support.

1

First I've ever heard of it and can't say I understand it, but. . . I appreciate the share, Guy, and will refer back to it if/when I need to. Looks like excellent information.

you know in Interrnet marketing and website building, ther's so much to learn.

1

VERY true!

Thanks s much for the post. It shares plenty of light on the topic of bread crumbs

thanks for reading.

See more comments

Join FREE & Launch Your Business!

Exclusive Bonus - Offer Ends at Midnight Today

00

Hours

:

00

Minutes

:

00

Seconds

2,000 AI Credits Worth $10 USD

Build a Logo + Website That Attracts Customers

400 Credits

Discover Hot Niches with AI Market Research

100 Credits

Create SEO Content That Ranks & Converts

800 Credits

Find Affiliate Offers Up to $500/Sale

10 Credits

Access a Community of 2.9M+ Members

By continuing, you agree to our Terms of Service and Privacy Policy
No credit card required

2.9M+

Members

190+

Countries Served

20+

Years Online

50K+

Success Stories

The world's most successful affiliate marketing training platform. Join 2.9M+ entrepreneurs building their online business with expert training, tools, and support.

© 2005-2025 Wealthy Affiliate
All rights reserved worldwide.

🔒 Trusted by Millions Worldwide

Since 2005, Wealthy Affiliate has been the go-to platform for entrepreneurs looking to build successful online businesses. With industry-leading security, 99.9% uptime, and a proven track record of success, you're in safe hands.