get_the_breadcrumb(); } function get_home( $echo = true ){ $output = ''; $on_front = get_option('show_on_front'); if ($on_front == "page") { $output = ''; } else { $output = ''; } if ( $echo ) { echo $output; } else { return $output; } } function search_reminder(){ global $post; $output = ''; if ( is_category() && category_description() ) { //prints category description $output = '
' . category_description() . '
'; } elseif (is_author()) { //prints author details $output = boozurk_author_badge( $post->post_author, 64 ); } elseif ( is_page() ) { //prints subpages list if ( $child_list = $this->multipages() ) $output = '
' . $child_list . '
'; } echo $output; } // page hierarchy function multipages(){ global $post; $args = array( 'post_type' => 'page', 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order', 'numberposts' => 0, 'no_found_rows' => true ); $childrens = get_posts( $args ); // retrieve the child pages $the_child_list = ''; if ( $childrens ) { foreach ($childrens as $children) { $the_child_list[] = '' . get_the_title( $children ) . ''; } $the_child_list = implode(' | ' , $the_child_list); $the_child_list = '' . $the_child_list; } return $the_child_list; } // Copied and adapted from WP source function get_category_parents( $id, $link = false, $separator = '/', $nicename = false ) { $chain = ''; $parent = get_category( $id ); if ( is_wp_error( $parent ) ) return $parent; if ( $nicename ) $name = $parent->slug; else $name = $parent->cat_name; if ( $parent->parent && ( $parent->parent != $parent->term_id ) ) $chain .= get_category_parents( $parent->parent, true, $separator, $nicename ); $chain .= '' . $name. ''; return $chain; } /* the breadcrumb walker Based on Yoast Breadcrumbs Plugin (http://yoast.com/wordpress/breadcrumbs/) */ function get_the_breadcrumb( $before = '
', $after = '
' ) { global $wp_query, $post; $output = apply_filters( 'boozurk_filter_breadcrumb', '' ); if ( ! empty ( $output ) ) return $output; $opt = array(); $opt['home'] = __('Home', 'boozurk' ); $opt['sep'] = ' '; $opt['archiveprefix'] = __('Archives for %s', 'boozurk' ); $opt['searchprefix'] = __('Search for "%s"', 'boozurk' ); $opt['nofollow'] = ' rel="nofollow" '; $on_front = get_option('show_on_front'); $items_found = $wp_query->found_posts ? ' (' . $wp_query->found_posts . ')' : ''; if ( ( $on_front == "page" && is_front_page() ) || ( $on_front == "posts" && is_home() ) ) { $output = '' . $opt['home'] . ''; } elseif ( $on_front == "page" && is_home() ) { $output = '' . get_the_title( get_option( 'page_for_posts' ) ) . ''; } elseif ( !is_page() ) { $output = ''; if ( is_single() && has_category() ) { $cats = get_the_category(); $cat = $cats[0]; if ( is_object($cat) ) { if ($cat->parent != 0) { $output .= get_category_parents( $cat->term_id, true, $opt['sep'] ); } else { $output .= '' . $cat->name . '' . $opt['sep']; } } } if ( is_category() ) { $cat = intval( get_query_var('cat') ); $output .= $this->get_category_parents( $cat, false, $opt['sep'] ) . $items_found; } elseif ( is_tag() ) { $title = single_term_title( '', false ); $output .= '' . sprintf( $opt['archiveprefix'], $title ) . '' . $items_found; } elseif ( is_404() ) { $output .= '' . __( 'Page not found', 'boozurk' ) . ''; } elseif ( is_date() ) { if ( is_day() ) { $title = get_the_date(); } else if ( is_month() ) { $title = single_month_title( ' ', false ); } else if ( is_year() ) { $title = get_query_var( 'year' ); } $output .= '' . sprintf( $opt['archiveprefix'], $title ) . '' . $items_found; } elseif ( is_author() ) { $author = get_queried_object(); $title = $author->display_name; $output .= '' . sprintf( $opt['archiveprefix'], $title ) . '' . $items_found; } elseif ( is_search() ) { $output .= '' . sprintf( $opt['searchprefix'], stripslashes( strip_tags( get_search_query() ) ) ) . '' . $items_found; } elseif ( is_attachment() ) { if ( $post->post_parent ) { $output .= '' . get_the_title( $post->post_parent ) . '' . $opt['sep']; } $output .= '' . get_the_title() . ''; } elseif ( is_tax() ) { $taxonomy = get_taxonomy ( get_query_var('taxonomy') ); $term = single_term_title( '', false ); $output .= '' . $taxonomy->label . ': '. $term. '' . $items_found; } else { if ( get_query_var( 'page' ) ) { $output .= '' . get_the_title() . '' . $opt['sep'] . '' . sprintf ( __( 'Page %s', 'boozurk' ), get_query_var( 'page' ) ) . ''; } else { $output .= '' . get_the_title() . ''; } } } else { $post = $wp_query->get_queried_object(); // If this is a top level Page, it's simple to output the breadcrumb if ( 0 == $post->post_parent ) { if ( get_query_var( 'page' ) ) { $output = '' . get_the_title() . '' . $opt['sep'] . '' . sprintf ( __( 'Page %s', 'boozurk' ), get_query_var( 'page' ) ) . ''; } else { $output = '' . get_the_title() . ''; } } else { if ( isset( $post->ancestors ) ) { if ( is_array( $post->ancestors ) ) $ancestors = array_values( $post->ancestors ); else $ancestors = array( $post->ancestors ); } else { $ancestors = array( $post->post_parent ); } // Reverse the order so it's oldest to newest $ancestors = array_reverse( $ancestors ); // Add the current Page to the ancestors list (as we need it's title too) $ancestors[] = $post->ID; $links = array(); foreach ( $ancestors as $ancestor ) { $tmp = array(); $tmp['title'] = get_the_title( $ancestor ); $tmp['url'] = get_permalink( $ancestor ); $tmp['cur'] = false; if ($ancestor == $post->ID) { $tmp['cur'] = true; } $links[] = $tmp; } $output = ''; foreach ( $links as $link ) { if ( ! $link['cur'] ) { $output .= '' . $link['title'] . ''; $output .= $opt['sep']; } else { if ( get_query_var( 'page' ) ) { $output .= '' . $link['title'] . '' . $opt['sep'] . '' . sprintf ( __( 'Page %s', 'boozurk' ), get_query_var( 'page' ) ) . ''; } else { $output .= '' . $link['title'] . ''; } } } } } if ( get_query_var('paged') ) $output .= $opt['sep'] . '' . sprintf ( __( 'Page %s', 'boozurk' ), get_query_var( 'paged' ) ) . ''; return $before . $output . $after; } } new Boozurk_Breadcrumb;