Breadcrumbs is a technique for navigation that demonstrates the user’s location in a website. On any website there are hundreds and even a huge number of pages, breadcrumb navigation can enhance your user navigation for the website and helps them explorer your content in a simple way. Regarding usability, breadcrumbs diminish the amount of activities a site visitor needs to take in order to get to a higher-level page.
This post will display an orderly guide on the most proficient method to insert breadcrumbs to your website without any plugins, and without further ado let’s jump to the tutorial.
Step One: Go to your website and log into your WordPress dashboard (www.yourdomain.com/wp-admin) and enter your credentials, then enter the dashboard.
Step Two: In your dashboard enter your Appearance menu.
Step Three: In the Appearance menu, go to the “Editor” tab.
Step Four: Open the function.php file at the right hand side of the screen and copy and paste the following code in it.
<?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()
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>';
?>
Step Five
To call that function in the page you want, just copy and paste the following code in the header usually:
<?php the_breadcrumb(); ?>
Now, you’ve successfully added breadcrumbs to your website and helped your user explorer your content and navigate through them easily.
Create Breadcrumbs in Wordpress Without Plugin
No comments:
Post a Comment