This is feature image

How to Add Breadcrumbs in WordPress Without Plugin

Published by on February 18, 2024
Categories: BLOG WORDPRESS

In this article, you will learn how to add breadcrumbs in WordPress without plugin.

Adding a breadcrumb to your website or blog is crucial as it helps visitors navigate through your pages, posts, or categories.

Breadcrumbs are a representation of navigation paths to the current page and path links.

Why Add Breadcrumbs in WordPress 

There are multiple reasons why breadcrumbs are commonly used as navigation aids on websites, and WordPress sites.

Improved User Experience Through Better Navigation.

Breadcrumbs enable users to locate their location within the website’s structure easily. Breadcrumbs represent navigation paths to the current page and path links. by simply clicking on breadcrumb links user can move back to a higher level in the page hierarchy. This all contributes to a better user experience.

Breadcrumbs can be very useful in situations where it’s difficult to determine the current position of the user on a large website with several pages and a hierarchical structure.

Users can save time by using breadcrumbs to navigate through categories and subcategories repeatedly instead of using the browser’s back button repeatedly.

Website design is enhanced by using breadcrumbs, which aids in engaging users.

Positive Effect On SEO

Breadcrumb helps search engines to crawl the website by providing a navigation path. The breadcrumbs detection tab can be seen in the Google Search Console, which indicates that Google considers it a valuable feature for user experience and site crawling. So, the presence of breadcrumbs can have a beneficial effect on search engine optimization (SEO).

Breadcrumbs boost engagement by allowing users to find more content on the website. Users can easily navigate back and forward using breadcrumbs. The SEO is improved when users spend more time on the website.

Alternative Method of Navigation

Breadcrumb provides an alternative method of navigation when using screen readers and other assistive technologies, which increases accessibility on websites. Breadcrumbs are an effective way to navigate on mobile devices without cluttering the interface.

Represents the relationship between pages and how they are arranged in the overall structure of the website.

Beneficial for e-Commerce Websites

Breadcrumbs can be a great asset to e-commerce websites.

In eCommerce, it aids in discovering and navigating between categories and subcategories, which enhances the exploration of more products. This results in an increase in sales.

How to Add Breadcrumbs in WordPress Without Plugin

To Add Breadcrumbs in WordPress Without Plugin we need to insert code in WordPress functions.php and header.php file.

Follow the steps below to insert the code. 

Follow the steps below:

1 In the WordPress Dashboard left pan, select Appearance.

2 Click the Theme File Editor option link.

3 Click the functions.php file in the right pan.

How to Add Breadcrumbs in WordPress Without Plugin

Now copy and paste the following code in the functions.php file.

function get_breadcrumb() {

    echo '<a href="'.home_url().'" rel="nofollow">Home</a>';

    if (is_category() || is_single()) {

        echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;";

        the_category(' &bull; ');

            if (is_single()) {

                echo " &nbsp;&nbsp;&#187;&nbsp;&nbsp; ";

                the_title();

            }

    } elseif (is_page()) {

        echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;";

        echo the_title();

    } elseif (is_search()) {

        echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp; Search Results for... ";

        echo '"<em>';

        echo the_search_query();

        echo '</em>"';

    }

}

4 Now you have to insert the code into the header.php file. Search for the header.php file and insert the following code.

How to Add Breadcrumbs in WordPress Without Plugin

<?php if (!is_home()): ?>

    <div class="breadcrumb">

        <?php get_breadcrumb(); ?>

    </div>

    <?php endif; ?>

  

5 Click Update File to save change.

Now you will see breadcrumbs appearing on the pages, posts, or categories pages.

In the next picture, you can see the breadcrumb on the archive page.

How to Add Breadcrumbs in WordPress Without Plugin

In the next picture, you can see the breadcrumb on a single post page.

How to Add Breadcrumbs in WordPress Without Plugin

Conclusion

The use of breadcrumbs on a WordPress website can improve user navigation, SEO, accessibility, and overall user engagement. It assists users in navigating the website more efficiently. Users can discover more content.

You have learned in this tutorial how to add breadcrumbs in WordPress without plugin. We hope this tutorial will help you to add breadcrumbs to your WordPress website.

For more about breadcrumb visit the page

Related Posts

gurjit singh

Gurjit Singh is a Content Writer and Web developer. He has experience in theme development, front-end development, and digital market. He loves to share his knowledge to help others in creating Websites, WordPress blogs, and SEO.