.
*/
class simple_breadcrumb{
var $options;
var $_markup;
function simple_breadcrumb(){
$this->options = array( //change this array if you want another output scheme
'before' => ' ',
'after' => ' ',
'delimiter' => '>'
);
$markup = $this->options['before'].$this->options['delimiter'].$this->options['after'];
$this->_markup = $markup;
global $post;
echo '';
echo 'Home';
echo "";
if(!is_front_page() ){//&& !is_home()
echo $markup;
$output = $this->simple_breadcrumb_case($post);
if ( is_page() || is_single()) {
if($output != ''){
echo $output;
echo $markup;
}
echo '';
the_title();
echo ' ';
}else{
if($output != ''){
echo '';
echo $output;
echo ' ';
}
}
}
}
function simple_breadcrumb_case($der_post){
$markup = $this->_markup;
if (is_page()){
if($der_post->post_parent) {
$my_query = get_post($der_post->post_parent);
$this->simple_breadcrumb_case($my_query);
$link = '';
// including $markup in this next line was causing duplicate spacers in some scenarios.
$link .= ''. get_the_title($my_query->ID) . '';
return $link;
}
return '';
}
if(is_single()){
$category = get_the_category();
if (is_attachment()){
$my_query = get_post($der_post->post_parent);
$category = get_the_category($my_query->ID);
$ID = $category[0]->cat_ID;
if($der_post->post_parent !== 0){
echo get_category_parents($ID, TRUE, $markup, FALSE );
previous_post_link("%link $markup");
return '';
}
}else{
if (!empty($category)) {
$catlink = get_category_link( $category[0]->cat_ID );
return ''.esc_html($category[0]->cat_name).'';
}else{
//there is no category. show the "posts" blogroll page in its stead.
//unless it's a portfolio page.
if(get_post_type() == 'work'){
return 'Portfolio';
}
$link = '';
$link .= ''. get_the_title() . '';
return $link;
}
}
return '';
}// end if is_single
if(is_category()){
$category = get_the_category();
$i = $category[0]->cat_ID;
$parent = $category[0]-> category_parent;
if($parent > 0 && $category[0]->cat_name == single_cat_title("", false)){
echo get_category_parents($parent, TRUE, $markup, FALSE);
}
return single_cat_title('',FALSE);
}
if(is_author()){
global $wp_query;
$curauth = $wp_query->get_queried_object();
return esc_html('Posts by ','bliss') . ' ' . $curauth->nickname;
}
if( is_tag() ) {
$value = esc_html('Posts Tagged "','bliss');
$value .= esc_html( single_tag_title("", false), 'bliss' );
$value .= esc_html('": ', 'bliss');
return $value;
}
if(is_404()){ return esc_html('404 Not Found', 'bliss'); }
if(is_home()){ return esc_html(get_option( 'blogname', '') . ' Blog', 'bliss'); }
if(is_search()){
return esc_html('Search results for ','bliss') . esc_html( get_search_query(), 'bliss') ;
}
if(is_year()){ return get_the_time('Y'); }
if(is_month()){
$current_year = get_the_time('Y');
echo "".$current_year."".$markup;
return get_the_time('F');
}
if(is_day() || is_time()){
$current_year = get_the_time('Y');
$current_month = get_the_time('m');
$current_month_display = get_the_time('F');
echo "".$current_year."".$markup;
echo "".$current_month_display."".$markup;
return get_the_time('jS (l)');
}
if(is_post_type_archive('work')){
return 'Portfolio';
}
}// end simple_breadcrumb_case
}
?>