onetone_breadcrumb

The Onetone onetone breadcrumb class.

Defined (1)

The class is defined in the following location(s).

/includes/class-breadcrumb.php  
  1. class onetone_breadcrumb 
  2. var $options; 
  3.  
  4. function onetone_breadcrumb($options = "") { 
  5.  
  6. $this->options = array( //change this array if you want another output scheme 
  7. 'before' => '<span class="arrow"> ',  
  8. 'after' => ' </span>',  
  9. 'delimiter' => '»' 
  10. ); 
  11.  
  12. if(is_array($options)) 
  13. $this->options = array_merge($this->options, $options); 
  14.  
  15.  
  16. $markup = $this->options['before'].$this->options['delimiter'].$this->options['after']; 
  17.  
  18. global $post; 
  19. echo '<p class="breadcrumb"><a href="'.esc_url( home_url() ).'">'; 
  20. _e("Home", 'onetone'); 
  21. echo "</a>"; 
  22. if(!is_front_page()) {echo $markup;} 
  23.  
  24. $output = $this->onetone_simple_breadcrumb_case($post); 
  25.  
  26. echo "<span class='current_crumb'>"; 
  27. if ( is_page() || is_single()) { 
  28. if(is_front_page()) { 
  29. echo $markup; 
  30. the_title(); 
  31. }else{ 
  32. the_title(); 
  33.  
  34. }else{ 
  35. echo $output; 
  36. echo " </span></p>"; 
  37.  
  38. function onetone_simple_breadcrumb_case($der_post) 
  39. global $post;  
  40.  
  41. $markup = $this->options['before'].$this->options['delimiter'].$this->options['after']; 
  42. if (is_page()) { 
  43. if($der_post->post_parent) { 
  44. $my_query = get_post($der_post->post_parent);  
  45. $this->onetone_simple_breadcrumb_case($my_query); 
  46. $link = '<a href="'; 
  47. $link .= get_permalink($my_query->ID); 
  48. $link .= '">'; 
  49. $link .= ''. get_the_title($my_query->ID) . '</a>'. $markup; 
  50. echo $link; 
  51. }  
  52. return;  
  53. }  
  54.  
  55. if(is_single()) 
  56. $category = get_the_category(); 
  57. if (is_attachment()) { 
  58.  
  59. $my_query = get_post($der_post->post_parent);  
  60. $category = get_the_category($my_query->ID); 
  61.  
  62. if(isset($category[0])) 
  63. $ID = $category[0]->cat_ID; 
  64. $parents = get_category_parents($ID, TRUE, $markup, FALSE ); 
  65. if(!is_object($parents)) echo $parents; 
  66. previous_post_link("%link $markup"); 
  67.  
  68. }else{ 
  69.  
  70. $postType = get_post_type(); 
  71.  
  72. if($postType == 'post') 
  73. $ID = $category[0]->cat_ID; 
  74. echo get_category_parents($ID, TRUE, $markup, FALSE ); 
  75. else if($postType == 'portfolio') 
  76. $terms = get_the_term_list( $post->ID, 'portfolio_entries', '', '$$$', '' ); 
  77. $terms = explode('$$$', $terms); 
  78. echo $terms[0].$markup; 
  79.  
  80. return; 
  81.  
  82. if(is_tax()) { 
  83. $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
  84. return $term->name; 
  85.  
  86.  
  87.  
  88. if(is_category()) { 
  89. $category = get_the_category();  
  90.  
  91. $i = isset($category[0]->cat_ID)?$category[0]->cat_ID:0; 
  92. $parent = isset($category[0]-> category_parent)?$category[0]-> category_parent:0; 
  93.  
  94. if($parent > 0 && $category[0]->cat_name == single_cat_title("", false)) { 
  95. echo get_category_parents($parent, TRUE, $markup, FALSE); 
  96. return single_cat_title('', FALSE); 
  97.  
  98.  
  99. if(is_author()) { 
  100. $curauth = get_userdatabylogin(get_query_var('author_name')); 
  101. return "Author: ".$curauth->nickname; 
  102. if(is_tag()) { return "Tag: ".single_tag_title('', FALSE); } 
  103.  
  104. if(is_404()) { return _e("404 - Page not Found", 'onetone'); } 
  105.  
  106. if(is_search()) { return _e("Search", 'onetone');}  
  107.  
  108. if(is_year()) { return get_the_time('Y'); } 
  109.  
  110. if(is_month()) { 
  111. $k_year = get_the_time('Y'); 
  112. echo "<a href='".get_year_link($k_year)."'>".$k_year."</a>".$markup; 
  113. return get_the_time('F'); } 
  114.  
  115. if(is_day() || is_time()) {  
  116. $k_year = get_the_time('Y'); 
  117. $k_month = get_the_time('m'); 
  118. $k_month_display = get_the_time('F'); 
  119. echo "<a href='".get_year_link($k_year)."'>".$k_year."</a>".$markup; 
  120. echo "<a href='".get_month_link($k_year, $k_month)."'>".$k_month_display."</a>".$markup; 
  121.  
  122. return get_the_time('jS (l)'); } 
  123.  
  124.