Advertisement
afsarwebdev

wp-breadcrumb-dynamic

Jul 27th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. //put the bellow code in funtions.php
  2.  
  3. function get_breadcrumb() {
  4. echo '<a href="'.home_url().'" rel="nofollow">Home</a>';
  5. if (is_category() || is_single()) {
  6. echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;";
  7. the_category(' &bull; ');
  8. if (is_single()) {
  9. echo " &nbsp;&nbsp;&#187;&nbsp;&nbsp; ";
  10. the_title();
  11. }
  12. } elseif (is_page()) {
  13. echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;";
  14. echo the_title();
  15. } elseif (is_search()) {
  16. echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;Search Results for... ";
  17. echo '"<em>';
  18. echo the_search_query();
  19. echo '</em>"';
  20. }
  21. }
  22.  
  23. //Execute the following function if not work above for category display.
  24. function get_breadcrumb()
  25. {
  26. echo '<a href="' . home_url() . '" rel="nofollow">Home</a>';
  27. if (is_tax() || is_single()) {
  28. echo "&nbsp;&nbsp;<span class='ic_breadcrumb'>></span>&nbsp;&nbsp;";
  29. the_title();
  30. the_category(' &bull; ');
  31. if (is_single()) {
  32. echo "<span class='ic_breadcrumb'> > </span>";
  33. the_title();
  34. }
  35. } elseif (is_page()) {
  36. echo "&nbsp;&nbsp;<span class='ic_breadcrumb'>></span>&nbsp;&nbsp;";
  37. echo the_title();
  38. } elseif (is_search()) {
  39. echo "&nbsp;&nbsp;<span class='ic_breadcrumb'>></span>&nbsp;&nbsp;Search Results for... ";
  40. echo '"<em>';
  41. echo the_search_query();
  42. echo '</em>"';
  43. }
  44. }
  45.  
  46. // implement now in html bellow php code
  47. <div class="breadcrumb"><?php get_breadcrumb(); ?></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement