Create breadcrumbs function without plugin

Monday, January 4th, 2016 (0 Comment)

What is Breadcrumbs ?

Breadcrumbs is only menus that let users know where they are on a website. It usually first appears on the website, and is placed just below the header (top) or below title bars or headers. Especially, for those sites that have depth in the breadcrumbs becomes very useful when users drill down into complex inner structure of the site. In this article you will learn how to create your blog Breadcrumbs

Breadcrumbs is an integral component of the Website, it helped redirect the user and conducive for SEO. The fastest way is the most simple and we think to use Plugin, so WordPress has many plugins suitable for all your needs. You can search and download the plugin to try installing and using to see how.

However sometimes people avoid using too many plugins for various reasons such as fear of error, easily hacked, create garbage in the database or website running slow etc.. If you can develop breadcrumbs function for yourself it’s the best thing. Here’s the code you use to create Breadcrumbs without using Plugin. You’ll add the code below into the functions.php file.

breadcrumb function

  • line 7:  if you use the bootstrap library, just change css class name is “my_breadcrumb” to “breadcrumb” (breadcrumb class is the class integrated in bootstrap)
  • Line 12: use class of bootstrap to show icon home if you needed
  • Line 15: show breadcrumb in category and single page, you can modify to show depending on your purpose

But you should also create your own CSS to easily change and adjust according to your wishes. With the above breadcrumb function, it will display categories by <li> tag (line by line), you will adjust CSS to display categories on one line by <li> tag as following :

Finally, to show the breadcrumbs you open up the single.php file and call the breadcrumbs function in place appropriate.

You can just call this function directly without having to use if clauses. But it is also a good habit, so before using it, you should check whether it exists or not. If you call the function directly but if the function has not yet been created, it will error and destroy your website.

Tags: , ,

Related Posts

wordpress
Why should use WordPress Framework
wordpress
Create responsive menu in wordpress using bootstrap
wordpress
Related Posts functions in WordPress without using the plugin
wordpress
Set and show most viewed post on WordPress

Related Posts

wordpress
Why should use WordPress Framework
wordpress
Create responsive menu in wordpress using bootstrap
wordpress
Related Posts functions in WordPress without using the plugin
wordpress
Set and show most viewed post on WordPress

Leave a Reply

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