Advertisement
firoze

breadcrumb without plugin

Dec 22nd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.52 KB | None | 0 0
  1. // Open your functions.php and paste the code below in it:
  2. function the_breadcrumb() {
  3.                 echo '<ul id="crumbs">';
  4.         if (!is_home()) {
  5.                 echo '<li><a href="';
  6.                 echo get_option('home');
  7.                 echo '">';
  8.                 echo 'Home';
  9.                 echo "</a></li>";
  10.                 if (is_category() || is_single()) {
  11.                         echo '<li>';
  12.                         the_category(' </li><li> ');
  13.                         if (is_single()) {
  14.                                 echo "</li><li>";
  15.                                 the_title();
  16.                                 echo '</li>';
  17.                         }
  18.                 } elseif (is_page()) {
  19.                         echo '<li>';
  20.                         echo the_title();
  21.                         echo '</li>';
  22.                 }
  23.         }
  24.         elseif (is_tag()) {single_tag_title();}
  25.         elseif (is_day()) {echo"<li>Archive for "; the_time('F jS, Y'); echo'</li>';}
  26.         elseif (is_month()) {echo"<li>Archive for "; the_time('F, Y'); echo'</li>';}
  27.         elseif (is_year()) {echo"<li>Archive for "; the_time('Y'); echo'</li>';}
  28.         elseif (is_author()) {echo"<li>Author Archive"; echo'</li>';}
  29.         elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "<li>Blog Archives"; echo'</li>';}
  30.         elseif (is_search()) {echo"<li>Search Results"; echo'</li>';}
  31.         echo '</ul>';
  32. }
  33.  
  34.  
  35. // Once done, open header.php and call the function:
  36.  
  37. <?php the_breadcrumb(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement