Advertisement
hmbashar

WordPress Breadcrumb

Oct 16th, 2018
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. // breadcrumb
  2. function ration_the_breadcrumb() {
  3.     if (!is_front_page()) {
  4.         echo '<li class="breadcrumb-item"><a href="'.esc_url(site_url()).'">Home </a></li>';           
  5.         if (is_category() || is_single()) {
  6.             echo '<li class="breadcrumb-item active">';
  7.             the_category(', ');
  8.             echo '</li>';              
  9.             if (is_single()) {
  10.                 echo '<li class="breadcrumb-item active">'.get_the_title().'<li>'; 
  11.             }
  12.         } elseif (is_home()) {
  13.             echo '<li class="breadcrumb-item active"><a href="'.get_the_permalink(get_queried_object_id()).'">'.get_the_title(get_queried_object_id()).'</a><li>'; 
  14.         }elseif (is_page()) {
  15.             echo '<li class="breadcrumb-item active"><a href="'.get_the_permalink().'">'.get_the_title().'</a><li>';   
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement