コード例 #1
0
ファイル: core.wp.php プロジェクト: pcuervo/odc
 function axiom_show_breadcrumbs($args = array())
 {
     global $wp_query, $post;
     axiom_set_global('in_breadcrumbs', true);
     $args = array_merge(array('home' => __('Home', 'axiom'), 'home_url' => '', 'show_all_filters' => true, 'show_all_posts' => true, 'truncate_title' => 50, 'truncate_add' => '...', 'delimiter' => '<span class="breadcrumbs_delimiter"></span>', 'max_levels' => axiom_get_theme_option('breadcrumbs_max_level'), 'echo' => true), is_array($args) ? $args : array('home' => $args));
     $type = axiom_get_blog_type();
     $title = axiom_strshort(axiom_get_blog_title(), $args['truncate_title'], $args['truncate_add']);
     if (in_array($type, array('home', 'frontpage'))) {
         return '';
     }
     if ($args['max_levels'] <= 0) {
         $args['max_levels'] = 999;
     }
     $need_reset = true;
     $rez = $rez_parent = $rez_all = $rez_level = $rez_period = '';
     $cat = $parentTax = '';
     $level = $parent = $post_id = 0;
     // Get current post ID and path to current post/page/attachment ( if it have parent posts/pages )
     if ($type == 'page' || $type == 'attachment' || is_single()) {
         $pageParentID = isset($wp_query->post->post_parent) ? $wp_query->post->post_parent : 0;
         $post_id = $type == 'attachment' ? $pageParentID : (isset($wp_query->post->ID) ? $wp_query->post->ID : 0);
         while ($pageParentID > 0) {
             $pageParent = get_post($pageParentID);
             $level++;
             if ($level > $args['max_levels']) {
                 $rez_level = '...';
             } else {
                 $rez_parent = '<a class="breadcrumbs_item cat_post" href="' . get_permalink($pageParent->ID) . '">' . trim(axiom_strshort($pageParent->post_title, $args['truncate_title'], $args['truncate_add'])) . '</a>' . (!empty($rez_parent) ? $args['delimiter'] : '') . $rez_parent;
             }
             if (($pageParentID = $pageParent->post_parent) > 0) {
                 $post_id = $pageParentID;
             }
         }
     }
     $depth = 0;
     $taxonomy = apply_filters('axiom_filter_get_current_taxonomy', '', $type);
     $ex_cats = $taxonomy == 'category' ? explode(',', axiom_get_theme_option('exclude_cats')) : array();
     do {
         if ($depth++ == 0) {
             if (is_single() || is_attachment()) {
                 if ($args['show_all_filters']) {
                     $post_format = get_post_format($post_id);
                     if (($tpl_id = axiom_get_template_page_id('only-' . $post_format)) > 0) {
                         $level++;
                         if ($level > $args['max_levels']) {
                             $rez_level = '...';
                         } else {
                             $rez_all .= (!empty($rez_all) ? $args['delimiter'] : '') . '<a class="breadcrumbs_item all" href="' . get_permalink($tpl_id) . '">' . sprintf(__('All %s', 'axiom'), axiom_get_post_format_name($post_format, false)) . '</a>';
                         }
                     }
                 }
                 $cats = axiom_get_terms_by_post_id(array('post_id' => $post_id, 'taxonomy' => $taxonomy, 'exclude' => $ex_cats));
                 $cat = !empty($cats) && !empty($cats[$taxonomy]->terms) ? $cats[$taxonomy]->terms[0] : false;
                 if ($cat) {
                     $level++;
                     if ($level > $args['max_levels']) {
                         $rez_level = '...';
                     } else {
                         $rez_parent = '<a class="breadcrumbs_item cat_post" href="' . esc_url($cat->link) . '">' . trim(axiom_strshort($cat->name, $args['truncate_title'], $args['truncate_add'])) . '</a>' . (!empty($rez_parent) ? $args['delimiter'] : '') . $rez_parent;
                     }
                 }
             } else {
                 if ($type == 'category') {
                     $cat_id = (int) get_query_var('cat');
                     if (empty($cat_id)) {
                         $cat_id = get_query_var('category_name');
                     }
                     $cat = get_term_by((int) $cat_id > 0 ? 'id' : 'slug', $cat_id, 'category', OBJECT);
                 } else {
                     if (($tax = axiom_is_taxonomy()) != '') {
                         $cat = get_term_by('slug', get_query_var($tax), $tax, OBJECT);
                     }
                 }
             }
             if ($cat) {
                 $parent = $cat->parent;
                 $parentTax = $cat->taxonomy;
             }
         }
         if ($parent) {
             $cat = get_term_by('id', $parent, $parentTax, OBJECT);
             if ($cat) {
                 if (!in_array($cat->term_id, $ex_cats)) {
                     $cat_link = get_term_link($cat->slug, $cat->taxonomy);
                     $level++;
                     if ($level > $args['max_levels']) {
                         $rez_level = '...';
                     } else {
                         $rez_parent = '<a class="breadcrumbs_item cat_parent" href="' . esc_url($cat_link) . '">' . trim(axiom_strshort($cat->name, $args['truncate_title'], $args['truncate_add'])) . '</a>' . (!empty($rez_parent) ? $args['delimiter'] : '') . $rez_parent;
                     }
                 }
                 $parent = $cat->parent;
             }
         }
     } while ($parent);
     if ($args['show_all_posts']) {
         $all_title = axiom_get_stream_page_title($type);
         $all_parts = explode(':', $all_title);
         if (count($all_parts) > 1) {
             $all_title = trim($all_parts[1]);
         }
         if ($all_title && axiom_strtolower($title) != axiom_strtolower($all_title)) {
             $all_link = axiom_get_stream_page_link($type);
             $rez_all = '<a class="breadcrumbs_item all" href="' . esc_url($all_link) . '">' . $all_title . '</a>' . (!empty($rez_all) ? $args['delimiter'] : '') . $rez_all;
         }
     }
     $rez_period = apply_filters('axiom_filter_get_period_links', '', $type, $args['delimiter']);
     if (!is_front_page()) {
         // && !is_home()
         $rez .= (isset($args['home']) && $args['home'] != '' ? '<a class="breadcrumbs_item home" href="' . ($args['home_url'] ? $args['home_url'] : home_url()) . '">' . $args['home'] . '</a>' . $args['delimiter'] : '') . (!empty($rez_all) ? $rez_all . $args['delimiter'] : '') . (!empty($rez_level) ? $rez_level . $args['delimiter'] : '') . (!empty($rez_parent) ? $rez_parent . $args['delimiter'] : '') . (!empty($rez_period) ? $rez_period . $args['delimiter'] : '') . ($title ? '<span class="breadcrumbs_item current">' . $title . '</span>' : '');
     }
     if ($args['echo'] && !empty($rez)) {
         echo $rez;
     }
     axiom_set_global('in_breadcrumbs', false);
     return $rez;
 }
コード例 #2
0
ファイル: blog.php プロジェクト: pcuervo/odc
	<?php 
}
echo $container_end;
if (!$post_number) {
    if (is_search()) {
        axiom_show_post_layout(array('layout' => 'no-search'), false);
    } else {
        axiom_show_post_layout(array('layout' => 'no-articles'), false);
    }
} else {
    // Isotope filters list
    $filters = '';
    $filter_button_classes = 'isotope_filters_button';
    if ($show_filters == 'categories') {
        // Use categories as filter items
        $taxonomy = axiom_is_taxonomy();
        $cur_term = $taxonomy ? axiom_get_current_term($taxonomy) : 0;
        $portfolio_parent = $cur_term ? max(0, axiom_get_parent_taxonomy_by_property($cur_term->term_id, 'show_filters', 'yes', true, $taxonomy)) : 0;
        $args2 = array('type' => !empty($args['post_type']) ? $args['post_type'] : 'post', 'child_of' => $portfolio_parent, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 0, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => $taxonomy, 'pad_counts' => false);
        $portfolio_list = get_categories($args2);
        if (count($portfolio_list) > 0) {
            $filters .= '<a href="#" data-filter="*" class="' . esc_attr($filter_button_classes . ($portfolio_parent == $cur_term->term_id ? ' active' : '')) . '">' . __('All', 'axiom') . '</a>';
            foreach ($portfolio_list as $cat) {
                $filters .= '<a href="#" data-filter=".flt_' . esc_attr($cat->term_id) . '" class="' . esc_attr($filter_button_classes . ($cat->term_id == $cur_term->term_id ? ' active' : '')) . '">' . $cat->name . '</a>';
            }
        }
    } else {
        if ($show_filters == 'tags') {
            // Use tags as filter items
            if (count($flt_ids) > 0) {
                $filters .= '<a href="#" data-filter="*" class="' . esc_attr($filter_button_classes) . ' active">' . __('All', 'axiom') . '</a>';