WordPress Widgets are handly little pieces of code that usually come from plugins. They are usually displayed on sidebars. One of my favorite widget is the Pages Widget. One thing that is obviously lacking from the Pages Widget is a ‘Home’ link.
A number of WordPress themes use ‘Pages’ for navigation. The navigation links are usually located on top or just below the header. Theme designers usually add a custom ‘Home’ link in addition to listing the pages, ie, wp_list_pages().
If you use the Pages Widget, you can add a ‘Home’ link without adding a single line of code. The inspiration came from an earlier article I wrote about ‘Creating a WordPress Page With An External Link.’
Add A Home
Go to your Dashboard > Pages > Add New
Enter in the Title: <a href=”/”>Home<a/>
Leave the content blank. Publish.
You now have a WordPress Page pointing back to your main index page. Verify if the ‘Home’ link is reflected on the Sidebar.
Breadcrumbs in web terms are a chain of links that leads the user back to the main index page. This article will teach you how to manually create your own breadcrumbs within WordPress. You will place these codes in your WordPress themes just underneath your header, for example.
Create a Home
Let’s get started. Let’s create a home. Use this HTML and PHP code.
<a href=”<?php bloginfo(‘url’);?>”>Home</a>
Double Angle Quotation Marks
Let’s use a Guillemet or a Double Angle Quotation Mark to separate the links.
The symbol » equals to “»” in HTML.
Post and Page Titles
Let’s display the titles. The code for both post and page titles are the same.
<a href=”<?php echo get_permalink() ?>”><?php the_title(); ?></a>
All Together Now
<a href=”<?php bloginfo(‘url’);?>”>Home</a> » <a href=”<?php echo get_permalink() ?>”><?php the_title(); ?></a>
Home » Create Your Own WordPress Breadcrumbs
Just place this piece of code in your WordPress theme files: e.g. pages.php and single.php. For the main index.php page, you just need the Home link.
That’s it. Fairly easy.
You can get really elaborate by adding Categories, Months and Dates in your breadcrumb. Nevertheless, this article will get you started in the right direction.