public static function fix_breadcrumbs($html = '', $args = array())
 {
     if (function_exists('is_bbpress') && is_bbpress() && function_exists('bbp_get_breadcrumb')) {
         remove_filter('bbp_no_breadcrumb', '__return_true', 20);
         $html = bbp_get_breadcrumb(array('before' => $args['beforeBreadcrumbs'] . '<ol' . $args['listAttr'] . ' xmlns:v="http://rdf.data-vocabulary.org/#">', 'after' => '</ol>' . $args['afterBreadcrumbs'], 'sep' => $args['delimiter'] ? $args['delimiter'] : ' ', 'pad_sep' => false, 'sep_before' => '', 'sep_after' => '', 'crumb_before' => $args['linkBefore'], 'crumb_after' => $args['linkAfter'], 'current_before' => $args['before'], 'current_after' => $args['after']));
         $html = str_replace('<a ', '<a' . $args['linkAttr'], $html);
         if ($args['linkBefore'] && $args['before']) {
             $html = str_replace($args['linkBefore'] . $args['before'], $args['before'], $html);
         }
         if ($args['linkAfter'] && $args['after']) {
             $html = str_replace($args['linkAfter'] . $args['after'], $args['after'], $html);
         }
         add_filter('bbp_no_breadcrumb', '__return_true', 20);
     }
     return $html;
 }
Example #2
0
 function avia_bbpress_breadcrumb($trail)
 {
     global $avia_config;
     if (isset($avia_config['currently_viewing']) && $avia_config['currently_viewing'] == 'forum' || get_post_type() === "forum" || get_post_type() === "topic") {
         $bc = bbp_get_breadcrumb();
         if (isset($avia_config['bbpress_trail'])) {
             $trail_zero = $trail[0];
             $trail = $avia_config['bbpress_trail'];
             $trail[0] = $trail_zero;
         }
         if (bbp_is_single_user_edit() || bbp_is_single_user()) {
             $user_info = get_userdata(bbp_get_displayed_user_id());
             $title = __("Profile for User:", "avia_framework") . " " . $user_info->display_name;
             array_pop($trail);
             $trail[] = $title;
         }
     }
     return $trail;
 }
Example #3
0
/**
 * Output a breadcrumb
 *
 * @since bbPress (r2589)
 *
 * @param string $sep Separator. Defaults to '&larr;'
 * @param bool $current_page Include the current item
 * @param bool $root Include the root page if one exists
 * @uses bbp_get_breadcrumb() To get the breadcrumb
 */
function bbp_breadcrumb($args = array())
{
    echo bbp_get_breadcrumb($args);
}
Example #4
0
 /**
  * Filter breadcrumb for bbPress Topics
  */
 function breadcrumb()
 {
     $args = array('before' => '<div class="crumbs">', 'after' => '</div>', 'home_text' => '<i class="el-icon-home"></i><span class="screen-reader-text">Home</span>');
     return $breadcrumb = bbp_get_breadcrumb($args);
 }
Example #5
0
 function fave_breadcrumbs($options = array())
 {
     global $post;
     $text['home'] = '<i class="fa fa-home"></i>';
     // text for the 'Home' link
     $text['category'] = __('%s', 'magzilla');
     // text for a category page
     $text['tax'] = __('%s', 'magzilla');
     // text for a taxonomy page
     $text['search'] = __('Search Results for "%s" Query', 'magzilla');
     // text for a search results page
     $text['tag'] = __('%s', 'magzilla');
     // text for a tag page
     $text['author'] = __('Articles by: %s', 'magzilla');
     // text for an author page
     $text['404'] = __('Error 404', 'magzilla');
     // text for the 404 page
     $defaults = array('show_current' => 1, 'show_on_home' => 0, 'delimiter' => '', 'before' => '<li class="current">', 'after' => '</li>', 'home_before' => '', 'home_after' => '', 'home_link' => home_url() . '/', 'link_before' => '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">', 'link_after' => '</li>', 'link_attr' => '', 'link_in_before' => '', 'link_in_after' => '');
     extract($defaults);
     $link = '<a itemprop="url" href="%1$s">' . $link_in_before . '%2$s' . $link_in_after . '</a>';
     // form whole link option
     $link = $link_before . $link . $link_after;
     if (isset($options['text'])) {
         $options['text'] = array_merge($text, (array) $options['text']);
     }
     // override defaults
     extract($options);
     // regex replacement
     $replace = $link_before . '<a' . $link_attr . '\\1>' . $link_in_before . '\\2' . $link_in_after . '</a>' . $link_after;
     /*
      * Use bbPress's breadcrumbs when available
      */
     if (function_exists('bbp_breadcrumb') && is_bbpress()) {
         $bbp_crumbs = bbp_get_breadcrumb(array('home_text' => $text['home'], 'sep' => '', 'sep_before' => '', 'sep_after' => '', 'pad_sep' => 0, 'before' => $home_before, 'after' => $home_after, 'current_before' => $before, 'current_after' => $after));
         if ($bbp_crumbs) {
             echo '<ul class="breadcrumb favethemes_bbpress_breadcrumb">' . $bbp_crumbs . '</ul>';
             return;
         }
     }
     // normal breadcrumbs
     if (is_home() || is_front_page()) {
         if ($show_on_home == 1) {
             echo '<li>' . $home_before . '<a href="' . $home_link . '">' . $text['home'] . '</a>' . $home_after . '</li>';
         }
     } else {
         echo '<ul class="breadcrumb">' . $home_before . sprintf($link, $home_link, $text['home']) . $home_after . $delimiter;
         if (is_category() || is_tax()) {
             $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
             if ($term) {
                 $post_type = get_post_type_object(get_post_type());
                 printf($link, get_post_type_archive_link(get_post_type()), $post_type->labels->name);
                 $parent = $term->parent;
                 while ($parent) {
                     $parents[] = $parent;
                     $new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
                     $parent = $new_parent->parent;
                 }
                 if (!empty($parents)) {
                     $parents = array_reverse($parents);
                     // For each parent, create a breadcrumb item
                     foreach ($parents as $parent) {
                         $item = get_term_by('id', $parent, get_query_var('taxonomy'));
                         $url = home_url() . '/' . $item->taxonomy . '/' . $item->slug;
                         echo '<li><a href="' . $url . '">' . $item->name . '</a></li>';
                     }
                 }
                 // Display the current term in the breadcrumb
                 echo '<li>' . $term->name . '</li>';
             } else {
                 $the_cat = get_category(get_query_var('cat'), false);
                 // have parents?
                 if ($the_cat->parent != 0) {
                     $cats = get_category_parents($the_cat->parent, true, $delimiter);
                     $cats = preg_replace('#<a([^>]+)>([^<]+)</a>#', $replace, $cats);
                     echo $cats;
                 }
                 // print category
                 echo $before . sprintf(is_category() ? $text['category'] : $text['tax'], single_cat_title('', false)) . $after;
             }
             // end terms else
         } else {
             if (is_search()) {
                 echo $before . sprintf($text['search'], get_search_query()) . $after;
             } else {
                 if (is_day()) {
                     echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter . sprintf($link, get_month_link(get_the_time('Y'), get_the_time('m')), get_the_time('F')) . $delimiter . $before . get_the_time('d') . $after;
                 } else {
                     if (is_month()) {
                         echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter . $before . get_the_time('F') . $after;
                     } else {
                         if (is_year()) {
                             echo $before . get_the_time('Y') . $after;
                         } else {
                             if (is_single() && !is_attachment()) {
                                 // custom post type
                                 if (get_post_type() != 'post') {
                                     $post_type = get_post_type_object(get_post_type());
                                     printf($link, get_post_type_archive_link(get_post_type()), $post_type->labels->name);
                                     if ($show_current == 1) {
                                         echo $delimiter . $before . get_the_title() . $after;
                                     }
                                 } else {
                                     $cat = get_the_category();
                                     $cats = get_category_parents($cat[0], true, $delimiter);
                                     if ($show_current == 0) {
                                         $cats = preg_replace("#^(.+){$delimiter}\$#", "\$1", $cats);
                                     }
                                     $cats = preg_replace('#<a([^>]+)>([^<]+)</a>#', $replace, $cats);
                                     echo $cats;
                                     if ($show_current == 1) {
                                         echo $before . get_the_title() . $after;
                                     }
                                 }
                                 // end else
                             } elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) {
                                 $post_type = get_post_type_object(get_post_type());
                                 echo $before . $post_type->labels->name . $after;
                             } elseif (is_attachment()) {
                                 $parent = get_post($post->post_parent);
                                 $cat = current(get_the_category($parent->ID));
                                 $cats = get_category_parents($cat, true, $delimiter);
                                 if (!is_wp_error($cats)) {
                                     $cats = preg_replace('#<a([^>]+)>([^<]+)</a>#', $replace, $cats);
                                     echo $cats;
                                 }
                                 printf($link, get_permalink($parent), $parent->post_title);
                                 if ($show_current == 1) {
                                     echo $delimiter . $before . get_the_title() . $after;
                                 }
                             } elseif (is_page() && !$post->post_parent && $show_current == 1) {
                                 echo $before . get_the_title() . $after;
                             } elseif (is_page() && $post->post_parent) {
                                 $parent_id = $post->post_parent;
                                 $breadcrumbs = array();
                                 while ($parent_id) {
                                     $page = get_post($parent_id);
                                     $breadcrumbs[] = sprintf($link, get_permalink($page->ID), get_the_title($page->ID));
                                     $parent_id = $page->post_parent;
                                 }
                                 $breadcrumbs = array_reverse($breadcrumbs);
                                 for ($i = 0; $i < count($breadcrumbs); $i++) {
                                     echo $breadcrumbs[$i];
                                     if ($i != count($breadcrumbs) - 1) {
                                         echo $delimiter;
                                     }
                                 }
                                 if ($show_current == 1) {
                                     echo $delimiter . $before . get_the_title() . $after;
                                 }
                             } elseif (is_tag()) {
                                 echo $before . sprintf($text['tag'], single_tag_title('', false)) . $after;
                             } elseif (is_author()) {
                                 global $author;
                                 $userdata = get_userdata($author);
                                 echo $before . sprintf($text['author'], $userdata->display_name) . $after;
                             } elseif (is_404()) {
                                 echo $before . $text['404'] . $after;
                             }
                         }
                     }
                 }
             }
         }
         // have pages?
         if (get_query_var('paged')) {
             if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
                 echo ' (' . __('Page', 'magzilla') . ' ' . get_query_var('paged') . ')';
             }
         }
         echo '</ul>';
     }
 }
Example #6
0
 function breadcrumb($prefix = '', $suffix = '', $display = true)
 {
     $options = get_mervin_options();
     global $wp_query, $post, $paged;
     $opt = get_option("mervin_breadcrumbs");
     $on_front = get_option('show_on_front');
     $blog_page = get_option('page_for_posts');
     $sep = isset($opt['breadcrumbs-sep']) && $opt['breadcrumbs-sep'] != '' ? $opt['breadcrumbs-sep'] : '&raquo;';
     $home = isset($opt['breadcrumbs-home']) && $opt['breadcrumbs-home'] != '' ? $opt['breadcrumbs-home'] : __('Home');
     $selmenu = isset($opt['breadcrumbs-selectedmenu']) && $opt['breadcrumbs-selectedmenu'] != '' ? $opt['breadcrumbs-selectedmenu'] : 0;
     if ("page" == $on_front && 'post' == get_post_type()) {
         $homelink = '<a href="' . get_permalink(get_option('page_on_front')) . '">' . $home . '</a>';
         $bloglink = $homelink;
         if ($blog_page && (!isset($opt['breadcrumbs-blog-remove']) || !$opt['breadcrumbs-blog-remove'])) {
             $bloglink = $homelink . ' ' . $sep . ' <a href="' . get_permalink($blog_page) . '">' . $this->get_bc_title($blog_page) . '</a>';
         }
     } else {
         $homelink = '<a href="' . get_bloginfo('url') . '">' . $home . '</a>';
         $bloglink = $homelink;
     }
     if ($on_front == "page" && is_front_page() || $on_front == "posts" && is_home()) {
         $output = $this->bold_or_not($home);
     } else {
         if ($on_front == "page" && is_home()) {
             $output = $homelink . ' ' . $sep . ' ' . $this->bold_or_not($this->get_bc_title($blog_page));
         } else {
             if (is_singular()) {
                 $output = $bloglink . ' ' . $sep . ' ';
                 if (isset($opt['breadcrumbs-menus']) && ($opt['breadcrumbs-menus'] = 'on')) {
                     $use_menu = $this->in_menu($selmenu);
                 }
                 if (function_exists('bbp_body_class') && count(bbp_body_class(array())) > 1) {
                     remove_filter('bbp_get_breadcrumb', '__return_false');
                     $output .= bbp_get_breadcrumb(' ' . $sep . ' ');
                     add_filter('bbp_get_breadcrumb', '__return_false');
                 } else {
                     if (isset($use_menu) && $use_menu) {
                         $trail = $this->get_menu_trail();
                         $trail = array_reverse($trail);
                         $trailposts = array();
                         for ($t = 0; $t < count($trail); $t++) {
                             $trailposts[] = $this->get_post_for_menunode($trail[$t]);
                         }
                         for ($t = 0; $t < count($trail); $t++) {
                             $bctitle = get_the_title($trail[$t]) == '' ? get_the_title($trailposts[$t]) : get_the_title($trail[$t]);
                             $output .= '<a href="' . get_permalink($trailposts[$t]) . '">' . $bctitle . '</a> ' . $sep . ' ';
                         }
                         $output .= $this->bold_or_not($this->get_bc_title($post->ID));
                     } else {
                         $post_type = get_post_type();
                         if (function_exists('get_post_type_archive_link') && get_post_type_archive_link($post_type)) {
                             if (isset($options['bctitle-ptarchive-' . $post_type]) && '' != $options['bctitle-ptarchive-' . $post_type]) {
                                 $archive_title = $options['bctitle-ptarchive-' . $post_type];
                             } else {
                                 $post_type_obj = get_post_type_object($post_type);
                                 $archive_title = $post_type_obj->labels->menu_name;
                             }
                             $output .= '<a href="' . get_post_type_archive_link($post_type) . '">' . $archive_title . '</a> ' . $sep . ' ';
                         }
                         if (0 == $post->post_parent) {
                             if (isset($opt['post_types-' . $post->post_type . '-maintax']) && $opt['post_types-' . $post->post_type . '-maintax'] != '0') {
                                 $main_tax = $opt['post_types-' . $post->post_type . '-maintax'];
                                 $terms = wp_get_object_terms($post->ID, $main_tax);
                                 if (is_taxonomy_hierarchical($main_tax) && $terms[0]->parent != 0) {
                                     $parents = $this->get_term_parents($terms[0], $main_tax);
                                     $parents = array_reverse($parents);
                                     foreach ($parents as $parent) {
                                         $bctitle = zeo_get_term_meta($parent, $main_tax, 'bctitle');
                                         if (!$bctitle) {
                                             $bctitle = $parent->name;
                                         }
                                         $output .= '<a href="' . get_term_link($parent, $main_tax) . '">' . $bctitle . '</a> ' . $sep . ' ';
                                     }
                                 }
                                 if (count($terms) > 0) {
                                     $bctitle = zeo_get_term_meta($terms[0], $main_tax, 'bctitle');
                                     if (!$bctitle) {
                                         $bctitle = $terms[0]->name;
                                     }
                                     $output .= '<a href="' . get_term_link($terms[0], $main_tax) . '">' . $bctitle . '</a> ' . $sep . ' ';
                                 }
                             }
                             $output .= $this->bold_or_not($this->get_bc_title($post->ID));
                         } 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);
                             foreach ($ancestors as $ancestor) {
                                 $output .= '<a href="' . get_permalink($ancestor) . '">' . $this->get_bc_title($ancestor) . '</a> ' . $sep . ' ';
                             }
                             $output .= $this->bold_or_not($this->get_bc_title($post->ID));
                         }
                     }
                 }
             } else {
                 if (!is_404()) {
                     $output = $bloglink . ' ' . $sep . ' ';
                 } else {
                     $output = $homelink . ' ' . $sep . ' ';
                 }
                 // echo '<pre>'.print_r($wp_query,1).'</pre>';
                 if (function_exists('is_post_type_archive') && is_post_type_archive()) {
                     $post_type = get_post_type();
                     if (isset($options['bctitle-ptarchive-' . $post_type]) && '' != $options['bctitle-ptarchive-' . $post_type]) {
                         $archive_title = $options['bctitle-ptarchive-' . $post_type];
                     } else {
                         $post_type_obj = get_post_type_object($post_type);
                         $archive_title = $post_type_obj->labels->menu_name;
                     }
                     $output .= $this->bold_or_not($archive_title);
                 } else {
                     if (is_tax() || is_tag() || is_category()) {
                         $term = $wp_query->get_queried_object();
                         if (isset($options['taxonomy-' . $term->taxonomy . '-ptparent']) && $options['taxonomy-' . $term->taxonomy . '-ptparent'] != '') {
                             $post_type = $options['taxonomy-' . $term->taxonomy . '-ptparent'];
                             if ('post' == $post_type && get_option('show_on_front') == 'page') {
                                 $posts_page = get_option('page_for_posts');
                                 if ($posts_page) {
                                     $output .= '<a href="' . get_permalink($posts_page) . '">' . $this->get_bc_title($posts_page) . '</a> ' . $sep . ' ';
                                 }
                             } else {
                                 if (isset($options['bctitle-ptarchive-' . $post_type]) && '' != $options['bctitle-ptarchive-' . $post_type]) {
                                     $archive_title = $options['bctitle-ptarchive-' . $post_type];
                                 } else {
                                     $post_type_obj = get_post_type_object($post_type);
                                     $archive_title = $post_type_obj->labels->menu_name;
                                 }
                                 $output .= '<a href="' . get_post_type_archive_link($post_type) . '">' . $archive_title . '</a> ' . $sep . ' ';
                             }
                         }
                         if (is_taxonomy_hierarchical($term->taxonomy) && $term->parent != 0) {
                             $parents = $this->get_term_parents($term, $term->taxonomy);
                             $parents = array_reverse($parents);
                             foreach ($parents as $parent) {
                                 $bctitle = zeo_get_term_meta($parent, $term->taxonomy, 'bctitle');
                                 if (!$bctitle) {
                                     $bctitle = $parent->name;
                                 }
                                 $output .= '<a href="' . get_term_link($parent, $term->taxonomy) . '">' . $bctitle . '</a> ' . $sep . ' ';
                             }
                         }
                         $bctitle = zeo_get_term_meta($term, $term->taxonomy, 'bctitle');
                         if (!$bctitle) {
                             $bctitle = $term->name;
                         }
                         if ($paged) {
                             $output .= $this->bold_or_not('<a href="' . get_term_link($term, $term->taxonomy) . '">' . $bctitle . '</a>');
                         } else {
                             $output .= $this->bold_or_not($bctitle);
                         }
                     } else {
                         if (is_date()) {
                             if (isset($opt['breadcrumbs-archiveprefix'])) {
                                 $bc = $opt['breadcrumbs-archiveprefix'];
                             } else {
                                 $bc = __('Archives for');
                             }
                             if (is_day()) {
                                 global $wp_locale;
                                 $output .= '<a href="' . get_month_link(get_query_var('year'), get_query_var('monthnum')) . '">' . $wp_locale->get_month(get_query_var('monthnum')) . ' ' . get_query_var('year') . '</a> ' . $sep . ' ';
                                 $output .= $this->bold_or_not($bc . " " . get_the_date());
                             } else {
                                 if (is_month()) {
                                     $output .= $this->bold_or_not($bc . " " . single_month_title(' ', false));
                                 } else {
                                     if (is_year()) {
                                         $output .= $this->bold_or_not($bc . " " . get_query_var('year'));
                                     }
                                 }
                             }
                         } elseif (is_author()) {
                             if (isset($opt['breadcrumbs-archiveprefix'])) {
                                 $bc = $opt['breadcrumbs-archiveprefix'];
                             } else {
                                 $bc = __('Archives for');
                             }
                             $user = $wp_query->get_queried_object();
                             $output .= $this->bold_or_not($bc . " " . $user->display_name);
                         } elseif (is_search()) {
                             if (isset($opt['breadcrumbs-searchprefix']) && $opt['breadcrumbs-searchprefix'] != '') {
                                 $bc = $opt['breadcrumbs-searchprefix'];
                             } else {
                                 $bc = __('You searched for');
                             }
                             $output .= $this->bold_or_not($bc . ' "' . stripslashes(strip_tags(get_search_query())) . '"');
                         } elseif (isset($wp_query->query_vars['bbp_topic_tag'])) {
                             remove_filter('bbp_get_breadcrumb', '__return_false');
                             $output .= bbp_get_breadcrumb(' ' . $sep . ' ');
                             add_filter('bbp_get_breadcrumb', '__return_false');
                         } elseif (is_404()) {
                             if (isset($opt['breadcrumbs-404crumb']) && $opt['breadcrumbs-404crumb'] != '') {
                                 $crumb404 = $opt['breadcrumbs-404crumb'];
                             } else {
                                 $crumb404 = __('Error 404: Page not found');
                             }
                             $output .= $this->bold_or_not($crumb404);
                         }
                     }
                 }
             }
         }
     }
     if (isset($opt['breadcrumbs-prefix']) && $opt['breadcrumbs-prefix'] != "") {
         $output = $opt['breadcrumbs-prefix'] . " " . $output;
     }
     if ($display) {
         echo $prefix . $output . $suffix;
         return true;
     } else {
         return $prefix . $output . $suffix;
     }
 }
Example #7
0
<?php

/**
 * @package    WordPress
 * @subpackage Everything
 * @since      1.0
 */
// Separator
$separator = '&rsaquo;';
// is_rtl() ? '&lsaquo;' : '&rsaquo;'
// bbPress
if (Everything::isPluginActive('bbpress') && Everything::to('bbpress/breadcrumbs') && is_bbpress()) {
    $breadcrumbs_html = bbp_get_breadcrumb(array('before' => '', 'after' => '', 'sep' => $separator, 'sep_before' => '', 'sep_after' => '', 'current_before' => '', 'current_after' => ''));
} else {
    if (Everything::isPluginActive('woocommerce') && Everything::to('woocommerce/breadcrumbs') && (is_shop() || is_product_taxonomy() || is_product())) {
        //  || is_cart() || is_checkout() || is_order_received_page() || is_account_page()
        $breadcrumbs_html = \Drone\Func::functionGetOutputBuffer('woocommerce_breadcrumb', array('delimiter' => $separator, 'wrap_before' => '', 'wrap_after' => ''));
    } else {
        if (Everything::isPluginActive('breadcrumb-navxt')) {
            $options = get_option('bcn_options');
            $separator = $options['hseparator'];
            $breadcrumbs_html = bcn_display(true);
        } else {
            if (Everything::isPluginActive('breadcrumb-trail')) {
                $breadcrumbs_html = breadcrumb_trail(array('separator' => $separator, 'show_browse' => false, 'echo' => false));
            } else {
                if (Everything::isPluginActive('wordpress-seo')) {
                    $options = get_option('wpseo_internallinks');
                    $separator = $options['breadcrumbs-sep'] ? $options['breadcrumbs-sep'] : '&raquo;';
                    $breadcrumbs_html = yoast_breadcrumb('', '', false);
                } else {
Example #8
0
 function x_breadcrumbs()
 {
     if (x_get_option('x_breadcrumb_display')) {
         global $post;
         $is_ltr = !is_rtl();
         $stack = x_get_stack();
         $delimiter = x_get_breadcrumb_delimiter();
         $home_text = x_get_breadcrumb_home_text();
         $home_link = home_url();
         $current_before = x_get_breadcrumb_current_before();
         $current_after = x_get_breadcrumb_current_after();
         $page_title = get_the_title();
         $blog_title = get_the_title(get_option('page_for_posts', true));
         if (!is_404()) {
             $post_parent = $post->post_parent;
         } else {
             $post_parent = '';
         }
         if (X_WOOCOMMERCE_IS_ACTIVE) {
             $shop_url = x_get_shop_link();
             $shop_title = x_get_option('x_' . $stack . '_shop_title');
             $shop_link = '<a href="' . $shop_url . '">' . $shop_title . '</a>';
         }
         echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;
         if (is_home()) {
             echo $current_before . $blog_title . $current_after;
         } elseif (is_category()) {
             $the_cat = get_category(get_query_var('cat'), false);
             if ($the_cat->parent != 0) {
                 echo get_category_parents($the_cat->parent, TRUE, $delimiter);
             }
             echo $current_before . single_cat_title('', false) . $current_after;
         } elseif (x_is_product_category()) {
             if ($is_ltr) {
                 echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after;
             } else {
                 echo $current_before . single_cat_title('', false) . $current_after . $delimiter . $shop_link;
             }
         } elseif (x_is_product_tag()) {
             if ($is_ltr) {
                 echo $shop_link . $delimiter . $current_before . single_tag_title('', false) . $current_after;
             } else {
                 echo $current_before . single_tag_title('', false) . $current_after . $delimiter . $shop_link;
             }
         } elseif (is_search()) {
             echo $current_before . __('Search Results for ', '__x__') . '&#8220;' . get_search_query() . '&#8221;' . $current_after;
         } elseif (is_singular('post')) {
             if (get_option('page_for_posts') == is_front_page()) {
                 echo $current_before . $page_title . $current_after;
             } else {
                 if ($is_ltr) {
                     echo '<a href="' . get_permalink(get_option('page_for_posts')) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
                 } else {
                     echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . get_permalink(get_option('page_for_posts')) . '">' . $blog_title . '</a>';
                 }
             }
         } elseif (x_is_portfolio()) {
             echo $current_before . get_the_title() . $current_after;
         } elseif (x_is_portfolio_item()) {
             $link = x_get_parent_portfolio_link();
             $title = x_get_parent_portfolio_title();
             if ($is_ltr) {
                 echo '<a href="' . $link . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
             } else {
                 echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . $link . '">' . $title . '</a>';
             }
         } elseif (x_is_product()) {
             if ($is_ltr) {
                 echo $shop_link . $delimiter . $current_before . $page_title . $current_after;
             } else {
                 echo $current_before . $page_title . $current_after . $delimiter . $shop_link;
             }
         } elseif (x_is_buddypress()) {
             if (bp_is_group()) {
                 echo '<a href="' . bp_get_groups_directory_permalink() . '">' . x_get_option('x_buddypress_groups_title') . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after;
             } elseif (bp_is_user()) {
                 echo '<a href="' . bp_get_members_directory_permalink() . '">' . x_get_option('x_buddypress_members_title') . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after;
             } else {
                 echo $current_before . x_buddypress_get_the_title() . $current_after;
             }
         } elseif (x_is_bbpress()) {
             remove_filter('bbp_no_breadcrumb', '__return_true');
             if (bbp_is_forum_archive()) {
                 echo $current_before . bbp_get_forum_archive_title() . $current_after;
             } else {
                 echo bbp_get_breadcrumb();
             }
             add_filter('bbp_no_breadcrumb', '__return_true');
         } elseif (is_page() && !$post_parent) {
             echo $current_before . $page_title . $current_after;
         } elseif (is_page() && $post_parent) {
             $parent_id = $post_parent;
             $breadcrumbs = array();
             if (is_rtl()) {
                 echo $current_before . $page_title . $current_after . $delimiter;
             }
             while ($parent_id) {
                 $page = get_page($parent_id);
                 $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
                 $parent_id = $page->post_parent;
             }
             if ($is_ltr) {
                 $breadcrumbs = array_reverse($breadcrumbs);
             }
             for ($i = 0; $i < count($breadcrumbs); $i++) {
                 echo $breadcrumbs[$i];
                 if ($i != count($breadcrumbs) - 1) {
                     echo $delimiter;
                 }
             }
             if ($is_ltr) {
                 echo $delimiter . $current_before . $page_title . $current_after;
             }
         } elseif (is_tag()) {
             echo $current_before . single_tag_title('', false) . $current_after;
         } elseif (is_author()) {
             global $author;
             $userdata = get_userdata($author);
             echo $current_before . __('Posts by ', '__x__') . '&#8220;' . $userdata->display_name . $current_after . '&#8221;';
         } elseif (is_404()) {
             echo $current_before . __('404 (Page Not Found)', '__x__') . $current_after;
         } elseif (is_archive()) {
             if (x_is_shop()) {
                 echo $current_before . $shop_title . $current_after;
             } else {
                 echo $current_before . __('Archives ', '__x__') . $current_after;
             }
         }
         echo '</div>';
     }
 }
Example #9
0
/**
 * Breadcrumbs Functions
 *
 * @since 1.0
 * @param array $args
 * @return string
 */
function miss_get_breadcrumbs($args = '')
{
    global $wp_query;
    $breadcrumb_delimiter = miss_get_setting('breadcrumb_delimiter');
    $delimiter = !empty($breadcrumb_delimiter) ? html_entity_decode(htmlentities($breadcrumb_delimiter)) : '&raquo';
    /* Set up the default arguments for the breadcrumb. */
    $defaults = array('prefix' => '', 'suffix' => '', 'title' => '', 'home' => __('Home', MISS_TEXTDOMAIN), 'sep' => $delimiter, 'front_page' => false, 'bold' => true, 'show_blog' => true, 'singular_post_taxonomy' => null, 'echo' => false);
    $args = apply_filters('miss_breadcrumbs_args', $args);
    $args = wp_parse_args($args, $defaults);
    if (is_front_page() && !$args['front_page']) {
        return apply_filters('miss_get_breadcrumbs', false);
    }
    /* Format the title. */
    $html = !empty($args['title']) ? '<span class="breadcrumbs-title">' . $args['title'] . '</span>' : '';
    /* Format the separator. */
    $separator = !empty($args['sep']) ? ' <span class="delimiter">' . $args['sep'] . '</span> ' : ' <span class="delimiter">/</span> ';
    $show_on_front = get_option('show_on_front');
    $home = '<a href="' . home_url('/') . '" rel="home" class="home_breadcrumb">' . $args['home'] . '</a>';
    if ('page' == $show_on_front && $args['show_blog']) {
        $bloglink = $home . $separator . '<a href="' . get_permalink(get_option('page_for_posts')) . '">' . get_the_title(get_option('page_for_posts')) . '</a>';
    } else {
        $bloglink = $home;
    }
    if (is_front_page()) {
        $html .= miss_breadcrumbs_bold($home, $args['bold']);
    } elseif (is_home()) {
        $html .= $home . $separator . miss_breadcrumbs_bold(get_the_title(get_option('page_for_posts')), $args['bold']);
    } elseif (function_exists('is_woocommerce') && is_woocommerce()) {
        $html .= $home . $separator . __("Store", MISS_TEXTDOMAIN);
        /* If viewing a portfolio post. */
    } elseif (is_singular('portfolio')) {
        $html .= $home . $separator;
        $gallery_id = miss_get_setting('portfolio_page');
        if (!empty($gallery_id)) {
            $html .= '<a href="' . get_permalink($gallery_id) . '" title="' . esc_attr(get_the_title($gallery_id)) . '">' . get_the_title($gallery_id) . '</a>' . $separator;
        }
        $html .= miss_breadcrumbs_bold(get_the_title(), $args['bold']);
        /* Added to refect miss_blog_page() */
        /* If viewing a singular post. */
    } elseif (is_singular('miss_gallery')) {
        $html .= $home . $separator;
        $gallery_id = miss_get_setting('gallery_page');
        if (!empty($gallery_id)) {
            $html .= '<a href="' . get_permalink($gallery_id) . '" title="' . esc_attr(get_the_title($gallery_id)) . '">' . get_the_title($gallery_id) . '</a>' . $separator;
        }
        $html .= miss_breadcrumbs_bold(get_the_title(), $args['bold']);
    } elseif (is_singular('news')) {
        $html .= $home . $separator;
        $gallery_id = miss_get_setting('news_page');
        if (!empty($gallery_id)) {
            $html .= '<a href="' . get_permalink($gallery_id) . '" title="' . esc_attr(get_the_title($gallery_id)) . '">' . get_the_title($gallery_id) . '</a>' . $separator;
        }
        $html .= miss_breadcrumbs_bold(get_the_title(), $args['bold']);
    } elseif (is_archive() && get_post_type() == 'news') {
        $html .= $home . $separator . __('News', MISS_TEXTDOMAIN);
    } elseif (get_post_type() == 'forum' || get_post_type() == 'topic' || get_post_type() == 'reply') {
        $html .= bbp_get_breadcrumb(array('before' => '', 'after' => '', 'sep' => $separator));
    } elseif (is_singular('benefits')) {
        $html .= $home . $separator;
        $gallery_id = miss_get_setting('benefits_page');
        if (!empty($gallery_id)) {
            $html .= '<a href="' . get_permalink($gallery_id) . '" title="' . esc_attr(get_the_title($gallery_id)) . '">' . get_the_title($gallery_id) . '</a>' . $separator;
        }
        $html .= miss_breadcrumbs_bold(get_the_title(), $args['bold']);
    } elseif (is_singular()) {
        $post_id = (int) $wp_query->get_queried_object_id();
        if (isset($wp_query) && isset($wp_query->post) && is_object($wp_query->post)) {
            if ('page' === $wp_query->post->post_type || 'pricetable' === $wp_query->post->post_type) {
                $html .= $home . $separator;
            } elseif ('page' !== $wp_query->post->post_type) {
                $html .= $bloglink . $separator;
                if (isset($args["singular_{$wp_query->post->post_type}_taxonomy"]) && is_taxonomy_hierarchical($args["singular_{$wp_query->post->post_type}_taxonomy"])) {
                    $terms = wp_get_object_terms($post_id, $args["singular_{$wp_query->post->post_type}_taxonomy"]);
                    $html .= miss_breadcrumbs_get_term_parents($terms[0], $args["singular_{$wp_query->post->post_type}_taxonomy"], $separator) . $separator;
                } elseif (isset($args["singular_{$wp_query->post->post_type}_taxonomy"])) {
                    $html .= get_the_term_list($post_id, $args["singular_{$wp_query->post->post_type}_taxonomy"], '', ', ', '') . $separator;
                }
            }
            if ((is_post_type_hierarchical($wp_query->post->post_type) || 'attachment' === $wp_query->post->post_type) && ($parents = miss_breadcrumbs_get_parents($wp_query->post->post_parent, $separator))) {
                $html .= $parents . $separator;
            }
        } else {
            if (miss_is_bp()) {
                $html .= $home . $separator;
            }
        }
        $html .= miss_breadcrumbs_bold(get_the_title(), $args['bold']);
    } elseif (is_archive()) {
        $html .= $bloglink . $separator;
        if (is_category() || is_tag() || is_tax()) {
            $term = $wp_query->get_queried_object();
            $taxonomy = get_taxonomy($term->taxonomy);
            if (is_taxonomy_hierarchical($term->taxonomy) && $term->parent && ($parents = miss_breadcrumbs_get_term_parents($term->parent, $term->taxonomy, $separator))) {
                $html .= $parents . $separator;
            }
            $html .= miss_breadcrumbs_bold($term->name, $args['bold']);
        } elseif (get_post_type() == 'news') {
            $html .= miss_breadcrumbs_bold(__('News', MISS_TEXTDOMAIN));
        } elseif (function_exists('is_post_type_archive') && is_post_type_archive()) {
            $post_type_object = get_post_type_object(get_query_var('post_type'));
            $html .= miss_breadcrumbs_bold($post_type_object->labels->name, $args['bold']);
        } elseif (is_date()) {
            if (is_day()) {
                $html .= miss_breadcrumbs_bold(__('Archives for ', MISS_TEXTDOMAIN) . get_the_time('F j, Y'), $args['bold']);
            } elseif (is_month()) {
                $html .= miss_breadcrumbs_bold(__('Archives for ', MISS_TEXTDOMAIN) . single_month_title(' ', false), $args['bold']);
            } elseif (is_year()) {
                $html .= miss_breadcrumbs_bold(__('Archives for ', MISS_TEXTDOMAIN) . get_the_time('Y'), $args['bold']);
            }
        } elseif (is_author()) {
            $html .= miss_breadcrumbs_bold(__('Archives by: ', MISS_TEXTDOMAIN) . get_the_author_meta('display_name', $wp_query->post->post_author), $args['bold']);
        }
    } elseif (miss_is_bp()) {
        global $bp;
        // we're outside the loop!
        //print_r( $bp );
        if (isset($bp) && is_object($bp) && isset($bp->current_component)) {
            // Assign some variables here
            $homeurl = get_bloginfo('url');
            $bp_page1 = $bp->members->root_slug;
            // bp_get_members_root_slug() // slug for the Members page. The BuddyPress default is 'members'.
            $bp_page2 = $bp->groups->root_slug;
            // bp_get_groups_root_slug() // slug for the Groups page. The BuddyPress default is 'groups'.
            $bp_page3 = $bp->activity->root_slug;
            // bp_get_activity_root_slug() // slug for the Activity page. The BuddyPress default is 'activity'.
            $bp_page4 = $bp->forums->root_slug;
            // bp_get_forums_root_slug() // slug for the Forums page. The BuddyPress default is 'forums'.
            //$bp_page5 = $bp->achievements->root_slug; // slug for the Achievements page. The BuddyPress default is 'achievements'.
            if (bp_is_group()) {
                $html .= $home . $separator . __('Groups', MISS_TEXTDOMAIN);
                if (is_404()) {
                    $html .= $separator . miss_breadcrumbs_bold(__('Not Found', MISS_TEXTDOMAIN), $args['bold']);
                }
            }
            if (bp_is_user() && !bp_is_register_page()) {
                $html .= $home . " {$separator} " . '<a href="' . $homeurl . '/' . $bp_page1 . '/">' . ucwords($bp_page1) . '</a>' . " {$separator} " . '<a href="' . $bp->displayed_user->domain . '">' . ucwords($bp->displayed_user->fullname) . '</a>' . " {$divider} " . ucwords($bp->current_component) . "";
            }
            if (!bp_is_blog_page() && (is_page() || is_page($bp_page1) || is_page($bp_page2) || is_page($bp_page3) || is_page($bp_page4)) && !bp_is_user() && !bp_is_single_item() && !bp_is_register_page()) {
                $html .= $home . " {$separator} " . get_the_title() . "";
            }
            if (bp_is_register_page()) {
                $html .= $home . " {$separator} " . get_the_title() . "";
            }
            if (bp_is_blog_page() && is_home() && $front == "page") {
                $html .= "<a href='" . $homeurl . "'>{$home}</a>" . " {$separator} " . $blog . "";
            }
            if (get_query_var('paged')) {
                if (bp_is_blog_page() && !(is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author())) {
                    $html .= ' (Page' . ' ' . get_query_var('paged') . ')';
                }
            }
            /* 		$html .= $home . $separator . miss_breadcrumbs_bold( __( 'Search results for "', MISS_TEXTDOMAIN ) . stripslashes( strip_tags( get_search_query() ) ) . '"', $args['bold'] ); */
        }
    } elseif (is_search()) {
        $html .= $home . $separator . miss_breadcrumbs_bold(__('Search results for "', MISS_TEXTDOMAIN) . stripslashes(strip_tags(get_search_query())) . '"', $args['bold']);
    } elseif (is_404()) {
        $html .= $home . $separator . miss_breadcrumbs_bold(__('Page Not Found', MISS_TEXTDOMAIN), $args['bold']);
    } else {
        $html = '';
    }
    if (class_exists('TribeEventsPro')) {
        if (class_exists('TribeEvents')) {
            $tec = TribeEvents::instance();
            $events_page = '<a href="' . home_url('/') . trailingslashit($tec->getOption('eventsSlug', 'events')) . '" title="' . __('Events', MISS_TEXTDOMAIN) . '">' . __('Events', MISS_TEXTDOMAIN) . '</a>';
            $html_event = $home . $separator . $events_page;
        }
        if (function_exists('tribe_is_month') && tribe_is_month()) {
            $html = $html_event;
            $html .= $separator . __('Events for', MISS_TEXTDOMAIN) . ' ' . Date("F Y", strtotime($wp_query->get('start_date')));
        }
        if (function_exists('tribe_is_day') && tribe_is_day()) {
            $html = $html_event;
            $html .= $separator . __('Events for', MISS_TEXTDOMAIN) . ' ' . Date("l, F jS Y", strtotime($wp_query->get('start_date')));
        }
        if (function_exists('tribe_is_week') && tribe_is_week()) {
            if (function_exists('tribe_get_first_week_day')) {
                $html = $html_event;
                $html .= $separator . sprintf(__('Events for week of %s', MISS_TEXTDOMAIN), Date("l, F jS Y", strtotime(tribe_get_first_week_day($wp_query->get('start_date')))));
            }
        }
        if (function_exists('tribe_is_map') && tribe_is_map() || function_exists('tribe_is_photo') && tribe_is_photo()) {
            if (tribe_is_past()) {
                $html = $html_event;
                $html .= $separator . __('Past Events', MISS_TEXTDOMAIN);
            } else {
                $html = $html_event;
                $html .= $separator . __('Upcoming Events', MISS_TEXTDOMAIN);
            }
        }
        if (function_exists('tribe_is_showing_all') && tribe_is_showing_all()) {
            $html = $html_event;
            $html .= $separator . sprintf('%s %s', __('All events for', MISS_TEXTDOMAIN), get_the_title());
        }
    }
    //$breadcrumbs = '<div class="breadcrumb breadcrumbs"><div class="breadcrumbs-plus">';
    $breadcrumbs = $args['prefix'];
    $breadcrumbs .= $html;
    $breadcrumbs .= $args['suffix'];
    //$breadcrumbs .= '</div></div>';
    $breadcrumbs = apply_filters('miss_get_breadcrumbs', $breadcrumbs);
    if (!$args['echo']) {
        return $breadcrumbs;
    }
    echo $breadcrumbs;
}
Example #10
0
 function wd_bbp_breadcrumb()
 {
     $args = array('before' => '<div class="bbp-breadcrumb container"><p>');
     echo bbp_get_breadcrumb($args);
 }
Example #11
0
function om_breadcrumbs($caption = '', $before = '<div class="breadcrumbs">', $after = '</div>', $separator = ' / ')
{
    global $post, $wp_query;
    $show_last = get_option(OM_THEME_PREFIX . 'breadcrumbs_show_current') == 'true';
    if (function_exists('is_bbpress') && is_bbpress()) {
        remove_filter('bbp_no_breadcrumb', '__return_true');
        echo bbp_get_breadcrumb(array('before' => $before, 'after' => $after, 'sep' => $separator, 'pad_sep' => 0, 'crumb_before' => $caption, 'include_current' => $show_last, 'home_text' => __('Home', 'om_theme')));
        add_filter('bbp_no_breadcrumb', '__return_true');
        return;
    }
    $out = array();
    if (is_home()) {
        if (is_front_page()) {
            // do nothing
            return;
        } else {
            $blog_page_id = get_option('page_for_posts');
            if ($blog_page_id) {
                $blog = get_post($blog_page_id);
                if ($show_last) {
                    $out[] = $blog->post_title;
                }
                om_breadcrumbs_add_parents($out, $blog);
            }
        }
    } elseif (is_attachment()) {
        if ($show_last) {
            $out[] = $post->post_title;
        }
        om_breadcrumbs_add_parents($out, $post);
    } elseif (is_page()) {
        if ($show_last) {
            $out[] = $post->post_title;
        }
        om_breadcrumbs_add_parents($out, $post);
    } elseif (is_single()) {
        if ($post->post_type == 'portfolio') {
            if ($show_last) {
                $out[] = $post->post_title;
            }
            if (function_exists('ompf_get_portfolio_root_page')) {
                $portfolio_page = ompf_get_portfolio_root_page($post->ID);
                if ($portfolio_page) {
                    $out[] = '<a href="' . get_permalink($portfolio_page->ID) . '">' . $portfolio_page->post_title . '</a>';
                    om_breadcrumbs_add_parents($out, $portfolio_page);
                }
            }
        } elseif ($post->post_type == 'testimonials') {
            if ($show_last) {
                $out[] = $post->post_title;
            }
        } elseif ($post->post_type == 'product' && function_exists('woocommerce_breadcrumb')) {
            ob_start();
            woocommerce_breadcrumb();
            $woo = ob_get_clean();
            $out[] = $woo;
            if ($show_last) {
                $out[] = $post->post_title;
            }
        } else {
            if ($show_last) {
                $out[] = $post->post_title;
            }
            $blog_page_id = get_option('page_for_posts');
            if ($blog_page_id) {
                $blog = get_post($blog_page_id);
                $out[] = '<a href="' . get_permalink($blog->ID) . '">' . $blog->post_title . '</a>';
                om_breadcrumbs_add_parents($out, $blog);
            } else {
                $args = array('post_type' => 'page', 'posts_per_page' => 1, 'meta_query' => array(array('key' => '_wp_page_template', 'value' => array('template-blog.php'), 'compare' => 'IN')));
                $blog_page = false;
                $tmp_q = new WP_Query($args);
                if ($tmp_q->post_count) {
                    $blog_page = $tmp_q->posts[0];
                }
                wp_reset_postdata();
                if ($blog_page) {
                    $out[] = '<a href="' . get_permalink($blog_page->ID) . '">' . $blog_page->post_title . '</a>';
                    om_breadcrumbs_add_parents($out, $blog_page);
                }
            }
        }
    } elseif (is_category() || is_tag() || is_day() || is_month() || is_year()) {
        if ($show_last) {
            $out[] = om_get_archive_page_title();
        }
        $blog_page_id = get_option('page_for_posts');
        if ($blog_page_id) {
            $blog = get_post($blog_page_id);
            $out[] = '<a href="' . get_permalink($blog->ID) . '">' . $blog->post_title . '</a>';
            om_breadcrumbs_add_parents($out, $blog);
        }
    } elseif (is_tax('portfolio-type')) {
        if ($show_last) {
            $out[] = $wp_query->queried_object->name;
        }
        $portfolio_root_cat = false;
        if ($wp_query->queried_object->parent) {
            $tmp = get_term($wp_query->queried_object->parent, 'portfolio-type');
            while ($tmp->parent) {
                $tmp = get_term($tmp->parent, 'portfolio-type');
            }
            $portfolio_root_cat = $tmp->term_id;
        }
        $args = array('post_type' => 'page', 'posts_per_page' => 1, 'meta_query' => array(array('key' => '_wp_page_template', 'value' => 'template-portfolio.php')));
        if ($portfolio_root_cat) {
            $args['meta_query'][] = array('key' => 'ompf_portfolio_categories', 'value' => array('0', '', $portfolio_root_cat), 'compare' => 'IN');
        }
        $tmp_q = new WP_Query($args);
        if ($tmp_q->post_count) {
            $portfolio_page = $tmp_q->posts[0];
        } else {
            $portfolio_page = false;
        }
        wp_reset_postdata();
        if ($portfolio_page) {
            $out[] = '<a href="' . get_permalink($portfolio_page->ID) . '">' . $portfolio_page->post_title . '</a>';
            om_breadcrumbs_add_parents($out, $portfolio_page);
        }
    }
    $out[] = '<a href="' . home_url() . '">' . __('Home', 'om_theme') . '</a>';
    if (is_rtl()) {
        echo wp_kses_post($before . implode($separator, $out) . $caption . (!$show_last ? $separator . '' : '') . $after);
    } else {
        echo wp_kses_post($before . $caption . implode($separator, array_reverse($out)) . (!$show_last ? $separator . '' : '') . $after);
    }
}
Example #12
0
 /**
  * Breadcrumbs
  * 
  * Adapted from http://dimox.net/wordpress-breadcrumbs-without-a-plugin/
  */
 public function breadcrumbs($options = array())
 {
     global $post;
     // preliminary checks
     if (Bunyad::options()->disable_breadcrumbs) {
         return;
     }
     $text['home'] = _x('Home', 'breadcrumbs', 'bunyad');
     // text for the 'Home' link
     $text['category'] = __('%s', 'bunyad');
     // text for a category page
     $text['tax'] = __('Archive for "%s"', 'bunyad');
     // text for a taxonomy page
     $text['search'] = __('Search Results for "%s" Query', 'bunyad');
     // text for a search results page
     $text['tag'] = __('Posts Tagged "%s"', 'bunyad');
     // text for a tag page
     $text['author'] = __('Author: %s', 'bunyad');
     // text for an author page
     $text['404'] = __('Error 404', 'bunyad');
     // text for the 404 page
     $defaults = array('show_current' => 1, 'show_on_home' => 0, 'delimiter' => '<span class="delim">&raquo;</span>', 'before' => '<span class="current">', 'after' => '</span>', 'home_before' => '<span class="location">' . __('You are at:', 'bunyad') . '</span>', 'home_after' => '', 'home_link' => home_url() . '/', 'link_before' => '<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">', 'link_after' => '</span>', 'link_attr' => ' itemprop="url" ', 'link_in_before' => '<span itemprop="title">', 'link_in_after' => '</span>', 'text' => $text);
     extract(apply_filters('bunyad_breadcrumbs_defaults', $defaults));
     $link = '<a itemprop="url" href="%1$s">' . $link_in_before . '%2$s' . $link_in_after . '</a>';
     // form whole link option
     $link = $link_before . $link . $link_after;
     if (isset($options['text'])) {
         $options['text'] = array_merge($text, (array) $options['text']);
     }
     // override defaults
     extract($options);
     // regex replacement
     $replace = $link_before . '<a' . $link_attr . '\\1>' . $link_in_before . '\\2' . $link_in_after . '</a>' . $link_after;
     /*
      * Use bbPress's breadcrumbs when available
      */
     if (function_exists('bbp_breadcrumb') && is_bbpress()) {
         $bbp_crumbs = bbp_get_breadcrumb(array('home_text' => $text['home'], 'sep' => $delimiter, 'sep_before' => '', 'sep_after' => '', 'pad_sep' => 0, 'before' => '<div class="breadcrumbs">' . $home_before, 'after' => $home_after . '</div>', 'current_before' => $before, 'current_after' => $after));
         if ($bbp_crumbs) {
             echo $bbp_crumbs;
             return;
         }
     }
     /*
      * Use WooCommerce's breadcrumbs when available
      */
     if (function_exists('woocommerce_breadcrumb') && (is_woocommerce() or is_cart() or is_shop())) {
         woocommerce_breadcrumb(array('delimiter' => $delimiter, 'before' => '', 'after' => '', 'wrap_before' => '<div class="breadcrumbs">' . $home_before, 'wrap_after' => $home_after . '</div>', 'home' => $text['home']));
         return;
     }
     // normal breadcrumbs
     if (is_home() || is_front_page()) {
         if ($show_on_home == 1) {
             echo '<div class="breadcrumbs">' . $home_before . '<a href="' . $home_link . '">' . $text['home'] . '</a>' . $home_after . '</div>';
         }
     } else {
         echo '<div class="breadcrumbs">' . $home_before . sprintf($link, $home_link, $text['home']) . $home_after . $delimiter;
         if (is_category() || is_tax()) {
             $the_cat = get_category(get_query_var('cat'), false);
             // have parents?
             if ($the_cat->parent != 0) {
                 $cats = get_category_parents($the_cat->parent, true, $delimiter);
                 $cats = preg_replace('#<a([^>]+)>([^<]+)</a>#', $replace, $cats);
                 echo $cats;
             }
             // print category
             echo $before . sprintf(is_category() ? $text['category'] : $text['tax'], single_cat_title('', false)) . $after;
         } else {
             if (is_search()) {
                 echo $before . sprintf($text['search'], get_search_query()) . $after;
             } else {
                 if (is_day()) {
                     echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter . sprintf($link, get_month_link(get_the_time('Y'), get_the_time('m')), get_the_time('F')) . $delimiter . $before . get_the_time('d') . $after;
                 } else {
                     if (is_month()) {
                         echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter . $before . get_the_time('F') . $after;
                     } else {
                         if (is_year()) {
                             echo $before . get_the_time('Y') . $after;
                         } else {
                             if (is_single() && !is_attachment()) {
                                 // custom post type
                                 if (get_post_type() != 'post') {
                                     $post_type = get_post_type_object(get_post_type());
                                     printf($link, get_post_type_archive_link(get_post_type()), $post_type->labels->name);
                                     if ($show_current == 1) {
                                         echo $delimiter . $before . get_the_title() . $after;
                                     }
                                 } else {
                                     $cat = get_the_category();
                                     $cats = get_category_parents($cat[0], true, $delimiter);
                                     if ($show_current == 0) {
                                         $cats = preg_replace("#^(.+){$delimiter}\$#", "\$1", $cats);
                                     }
                                     $cats = preg_replace('#<a([^>]+)>([^<]+)</a>#', $replace, $cats);
                                     echo $cats;
                                     if ($show_current == 1) {
                                         echo $before . get_the_title() . $after;
                                     }
                                 }
                             } elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) {
                                 $post_type = get_post_type_object(get_post_type());
                                 echo $before . $post_type->labels->name . $after;
                             } elseif (is_attachment()) {
                                 $parent = get_post($post->post_parent);
                                 $cat = current(get_the_category($parent->ID));
                                 $cats = get_category_parents($cat, true, $delimiter);
                                 if (!is_wp_error($cats)) {
                                     $cats = preg_replace('#<a([^>]+)>([^<]+)</a>#', $replace, $cats);
                                     echo $cats;
                                 }
                                 printf($link, get_permalink($parent), $parent->post_title);
                                 if ($show_current == 1) {
                                     echo $delimiter . $before . get_the_title() . $after;
                                 }
                             } elseif (is_page() && !$post->post_parent && $show_current == 1) {
                                 echo $before . get_the_title() . $after;
                             } elseif (is_page() && $post->post_parent) {
                                 $parent_id = $post->post_parent;
                                 $breadcrumbs = array();
                                 while ($parent_id) {
                                     $page = get_post($parent_id);
                                     $breadcrumbs[] = sprintf($link, get_permalink($page->ID), get_the_title($page->ID));
                                     $parent_id = $page->post_parent;
                                 }
                                 $breadcrumbs = array_reverse($breadcrumbs);
                                 for ($i = 0; $i < count($breadcrumbs); $i++) {
                                     echo $breadcrumbs[$i];
                                     if ($i != count($breadcrumbs) - 1) {
                                         echo $delimiter;
                                     }
                                 }
                                 if ($show_current == 1) {
                                     echo $delimiter . $before . get_the_title() . $after;
                                 }
                             } elseif (is_tag()) {
                                 echo $before . sprintf($text['tag'], single_tag_title('', false)) . $after;
                             } elseif (is_author()) {
                                 global $author;
                                 $userdata = get_userdata($author);
                                 echo $before . sprintf($text['author'], $userdata->display_name) . $after;
                             } elseif (is_404()) {
                                 echo $before . $text['404'] . $after;
                             }
                         }
                     }
                 }
             }
         }
         // have pages?
         if (get_query_var('paged')) {
             if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
                 echo ' (' . __('Page', 'bunyad') . ' ' . get_query_var('paged') . ')';
             }
         }
         echo '</div>';
     }
 }