WordPress Breadcrumb Links the Easy Way

There are several plugins that add breadcrumbs to Wordperss blog posts and pages but none are very easiliy configurable / styleable. I was using Yoast’s service from the WordPress SEO plugin, but decided to see if I could just hardcode something on the website. It was easy.

I added this code to the content-header.php file just above the H1 title part. I do not want breadcrumbs on the Pages, categories, home page or any other page, so added a bit of WordPress php to only show on Posts.

<?php if(is_single()) : ?>
<p><b>You are here: <a href=”http://www.webologist.co.uk/”>Home</a> > <?php the_category(‘ ‘); ?></b></p>
<?php endif; ?>

Note: if this breaks the site try re-typing the apostrophes in category, i.e. (‘ ‘) Seems that WordPress editor might have done something weird.

It is that simple. So no need to rely on plugins, just add a tiny bit of code. And of course, if you wanted, you could style it any way you liked. I might add a home image for the homepage, or something. When I get a moment ….

 

Leave a Reply

Your email address will not be published. Required fields are marked *