public function form($instance)
 {
     $this->instance = $instance;
     $title = isset($instance['title']) ? $instance['title'] : '';
     $category = $this->get_category_from_instance($instance);
     hocwp_field_widget_before($this->admin_args['class']);
     hocwp_widget_field_title($this->get_field_id('title'), $this->get_field_name('title'), $title);
     $all_option = '';
     $lists = hocwp_get_terms('link_category');
     foreach ($lists as $lvalue) {
         $selected = '';
         if (!hocwp_array_has_value($category)) {
             $category[] = array('value' => '');
         }
         foreach ($category as $ptvalue) {
             $ptype = isset($ptvalue['value']) ? $ptvalue['value'] : '';
             if ($lvalue->term_id == $ptype) {
                 $selected = $lvalue->term_id;
                 break;
             }
         }
         $all_option .= hocwp_field_get_option(array('value' => $lvalue->term_id, 'text' => $lvalue->name, 'selected' => $selected));
     }
     $args = array('id' => $this->get_field_id('category'), 'name' => $this->get_field_name('category'), 'all_option' => $all_option, 'value' => $category, 'label' => __('Category:', 'hocwp-theme'), 'placeholder' => __('Choose category', 'hocwp-theme'), 'multiple' => true);
     hocwp_widget_field('hocwp_field_select_chosen', $args);
     hocwp_field_widget_after();
 }
Example #2
0
function hocwp_fetch_administrative_boundaries_ajax_callback()
{
    $result = array();
    $default = hocwp_get_method_value('default');
    $default = str_replace('\\', '', $default);
    //$type = hocwp_get_method_value('type');
    if (empty($default)) {
    }
    $html_data = $default;
    $parent = hocwp_get_method_value('parent');
    if (hocwp_id_number_valid($parent)) {
        $taxonomy = hocwp_get_method_value('taxonomy');
        if (!empty($taxonomy)) {
            $terms = hocwp_get_terms($taxonomy, array('parent' => $parent, 'orderby' => 'NAME'));
            if (hocwp_array_has_value($terms)) {
                foreach ($terms as $term) {
                    $option = hocwp_field_get_option(array('value' => $term->term_id, 'text' => $term->name));
                    $html_data .= $option;
                }
            }
        }
    }
    $result['html_data'] = $html_data;
    wp_send_json($result);
}
 public function add_rewrite_rule($taxonomy_name, $tax_base, $wp_query_var, $query_var, $rules)
 {
     global $wp_rewrite;
     $new_rules = array();
     $taxonomy = get_taxonomy($taxonomy_name);
     $permalink_structure = get_option('permalink_structure');
     $blog_prefix = '';
     if (is_multisite() && !is_subdomain_install() && is_main_site() && 0 === strpos($permalink_structure, '/blog/')) {
         $blog_prefix = 'blog/';
     }
     $terms = hocwp_get_terms($taxonomy_name, array('hide_empty' => false));
     if (hocwp_array_has_value($terms)) {
         foreach ($terms as $term) {
             $term_nicename = $term->slug;
             if ($term->parent == $term->cat_ID) {
                 $term->parent = 0;
             } elseif ($taxonomy->rewrite['hierarchical'] != 0 && $term->parent != 0) {
                 $parents = hocwp_get_term_parents($taxonomy_name, $term->parent, false, '/', true);
                 if (!is_wp_error($parents)) {
                     $term_nicename = $parents . $term_nicename;
                 }
                 unset($parents);
             }
             $new_rules[$blog_prefix . '(' . $term_nicename . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?' . $wp_query_var . '=$matches[1]&feed=$matches[2]';
             $new_rules[$blog_prefix . '(' . $term_nicename . ')/' . $wp_rewrite->pagination_base . '/?([0-9]{1,})/?$'] = 'index.php?' . $wp_query_var . '=$matches[1]&paged=$matches[2]';
             $new_rules[$blog_prefix . '(' . $term_nicename . ')/?$'] = 'index.php?' . $wp_query_var . '=$matches[1]';
         }
         unset($terms, $term, $term_nicename);
     }
     $old_base = $wp_rewrite->get_extra_permastruct($taxonomy_name);
     $old_base = str_replace('%' . $tax_base . '%', '(.+)', $old_base);
     $old_base = trim($old_base, '/');
     $new_rules[$old_base . '$'] = 'index.php?' . $query_var . '=$matches[1]';
     if (hocwp_array_has_value($new_rules)) {
         $rules = $new_rules;
     }
     unset($new_rules, $old_base);
     return $rules;
 }
 public function widget($args, $instance)
 {
     $this->instance = $instance;
     $before_widget = hocwp_get_value_by_key($args, 'before_widget');
     $taxonomy = $this->get_taxonomy_from_instance($instance);
     $taxonomies = array();
     $widget_class = '';
     foreach ($taxonomy as $tax) {
         $tax = hocwp_get_value_by_key($tax, 'value');
         if (!empty($tax)) {
             $taxonomies[] = $tax;
             hocwp_add_string_with_space_before($widget_class, hocwp_sanitize_html_class($tax));
         }
     }
     $before_widget = hocwp_add_class_to_string('', $before_widget, $widget_class);
     $args['before_widget'] = $before_widget;
     $in_current_post = (bool) hocwp_get_value_by_key($instance, 'in_current_post', hocwp_get_value_by_key($this->args, 'in_current_post'));
     if ($in_current_post && (!is_singular() || is_page())) {
         return;
     }
     if ($in_current_post) {
         $post_id = get_the_ID();
         $current_post = get_post($post_id);
         $obj_taxs = get_object_taxonomies($current_post->post_type);
         $has_tax = false;
         foreach ($taxonomies as $tax) {
             foreach ($obj_taxs as $tax_name) {
                 if ($tax == $tax_name) {
                     $has_tax = true;
                     break;
                 }
             }
         }
         if (!$has_tax) {
             return;
         }
         $before_widget = hocwp_add_class_to_string('', $before_widget, 'in-current-post');
         $args['before_widget'] = $before_widget;
     }
     $number = hocwp_get_value_by_key($instance, 'number', hocwp_get_value_by_key($this->args, 'number'));
     if (0 > $number) {
         $number = 0;
     }
     $thumbnail_size = hocwp_get_value_by_key($instance, 'thumbnail_size', hocwp_get_value_by_key($this->args, 'thumbnail_size'));
     $thumbnail_size = hocwp_sanitize_size($thumbnail_size);
     $full_width_item = hocwp_get_value_by_key($instance, 'full_width_item', hocwp_get_value_by_key($this->args, 'full_width_item'));
     $show_count = hocwp_get_value_by_key($instance, 'show_count', hocwp_get_value_by_key($this->args, 'show_count'));
     $hide_thumbnail = hocwp_get_value_by_key($instance, 'hide_thumbnail', hocwp_get_value_by_key($this->args, 'hide_thumbnail'));
     $only_thumbnail = hocwp_get_value_by_key($instance, 'only_thumbnail', hocwp_get_value_by_key($this->args, 'only_thumbnail'));
     $order = hocwp_get_value_by_key($instance, 'order', hocwp_get_value_by_key($this->args, 'order'));
     $orderby = hocwp_get_value_by_key($instance, 'orderby', hocwp_get_value_by_key($this->args, 'orderby'));
     $count_format = hocwp_get_value_by_key($instance, 'count_format', hocwp_get_value_by_key($this->args, 'count_format'));
     $different_name = (bool) hocwp_get_value_by_key($instance, 'different_name', hocwp_get_value_by_key($this->args, 'different_name'));
     $hide_empty = hocwp_get_value_by_key($instance, 'hide_empty', hocwp_get_value_by_key($this->args, 'hide_empty'));
     $only_parent = hocwp_get_value_by_key($instance, 'only_parent', hocwp_get_value_by_key($this->args, 'only_parent'));
     $child_of_current = hocwp_get_value_by_key($instance, 'child_of_current', hocwp_get_value_by_key($this->args, 'child_of_current'));
     $child_of_parent = hocwp_get_value_by_key($instance, 'child_of_parent', hocwp_get_value_by_key($this->args, 'child_of_parent'));
     $parent_as_title = hocwp_get_value_by_key($instance, 'parent_as_title', hocwp_get_value_by_key($this->args, 'parent_as_title'));
     if ($hide_thumbnail) {
         $only_thumbnail = false;
     }
     $defaults = array('order' => $order, 'orderby' => $orderby, 'number' => absint($number));
     if (0 == $hide_empty || !(bool) $hide_empty) {
         $defaults['hide_empty'] = 0;
     } else {
         $defaults['hide_empty'] = 1;
     }
     if ($only_parent) {
         $defaults['parent'] = 0;
     }
     if ($in_current_post && is_singular()) {
         $terms = wp_get_post_terms(get_the_ID(), $taxonomies);
     } elseif (($child_of_current || $child_of_parent) && is_tax()) {
         $current_term = hocwp_term_get_current();
         $tax_args = array('child_of' => $current_term->term_id);
         $tax_args = wp_parse_args($tax_args, $defaults);
         unset($tax_args['parent']);
         $terms = hocwp_get_terms($current_term->taxonomy, $tax_args);
         if ($child_of_parent) {
             if (!hocwp_array_has_value($terms) && hocwp_id_number_valid($current_term->parent)) {
                 $parent = hocwp_term_get_top_most_parent($current_term);
                 $tax_args['child_of'] = $parent->term_id;
                 $terms = hocwp_get_terms($parent->taxonomy, $tax_args);
             }
         }
     } else {
         $terms = hocwp_get_terms($taxonomies, $defaults);
     }
     if (($in_current_post || $child_of_current) && !hocwp_array_has_value($terms)) {
         return;
     }
     if ($parent_as_title && is_tax()) {
         $current_term = hocwp_term_get_current();
         if (hocwp_id_number_valid($current_term->parent)) {
             $parent = hocwp_term_get_top_most_parent($current_term);
             $instance['title'] = $parent->name;
         } elseif ($child_of_current) {
             $instance['title'] = $current_term->name;
         }
     }
     hocwp_widget_before($args, $instance);
     ob_start();
     if (hocwp_array_has_value($terms)) {
         $count_terms = count($terms);
         $html = '<ul class="list-unstyled list-terms">';
         $count = 0;
         foreach ($terms as $term) {
             $item_class = 'term-item';
             hocwp_add_string_with_space_before($item_class, hocwp_sanitize_html_class('tax-' . $term->taxonomy));
             if (!(bool) $hide_thumbnail) {
                 hocwp_add_string_with_space_before($item_class, 'show-thumbnail');
             }
             if ((bool) $only_thumbnail) {
                 hocwp_add_string_with_space_before($item_class, 'only-thumbnail');
             }
             $full_width = hocwp_widget_item_full_width_result($full_width_item, $count_terms, $count);
             if ($full_width) {
                 hocwp_add_string_with_space_before($item_class, 'full-width');
             }
             if ((bool) $show_count) {
                 hocwp_add_string_with_space_before($item_class, 'show-count');
             } else {
                 hocwp_add_string_with_space_before($item_class, 'no-count');
             }
             $html .= '<li class="' . $item_class . '">';
             if (!(bool) $hide_thumbnail) {
                 $html .= hocwp_term_get_thumbnail_html(array('term' => $term, 'width' => $thumbnail_size[0], $thumbnail_size[1], 'bfi_thumb' => false));
             }
             if (!(bool) $only_thumbnail) {
                 $term_name = $term->name;
                 if ($different_name) {
                     $term_name = hocwp_term_get_name($term);
                 }
                 $html .= '<a class="term-name" href="' . get_term_link($term) . '">' . $term_name . '</a>';
                 if ((bool) $show_count && !empty($count_format)) {
                     $html .= ' <span class="count">' . str_replace('%TERM_COUNT%', $term->count, $count_format) . '</span>';
                 }
             }
             $html .= '</li>';
             $count++;
         }
         $html .= '</ul>';
         echo $html;
     } else {
         _e('Sorry, nothing found.', 'hocwp-theme');
     }
     $widget_html = ob_get_clean();
     $widget_html = apply_filters('hocwp_widget_term_html', $widget_html, $args, $instance, $this);
     echo $widget_html;
     hocwp_widget_after($args, $instance);
 }
Example #5
0
function hocwp_term_pagination($args = array())
{
    $query_vars = hocwp_get_value_by_key($args, 'query_vars', array());
    $posts_per_page = hocwp_get_value_by_key($query_vars, 'number', hocwp_get_posts_per_page());
    $offset = absint(hocwp_get_value_by_key($query_vars, 'offset'));
    $paged = hocwp_get_paged();
    $taxonomy = hocwp_get_value_by_key($args, 'taxonomy', 'category');
    if ($paged > 1) {
        $offset = ($paged - 1) * $posts_per_page;
    }
    $term_args = array('number' => 0, 'hide_empty' => false);
    $terms = hocwp_get_terms($taxonomy, $term_args);
    $total_page = 1;
    if (0 < $posts_per_page) {
        $total_page = ceil(count($terms) / $posts_per_page);
    }
    $args['current_page'] = $paged;
    $args['total_page'] = $total_page;
    $class = hocwp_get_value_by_key($args, 'class');
    hocwp_add_string_with_space_before($class, 'term-pagination');
    $args['class'] = $class;
    $result = hocwp_build_pagination($args);
    hocwp_pagination_before($args);
    echo $result;
    hocwp_pagination_after();
}
Example #6
0
function hocwp_field_select_term($args = array())
{
    hocwp_field_sanitize_args($args);
    $taxonomy = hocwp_get_value_by_key($args, 'taxonomy');
    $taxonomies = hocwp_get_value_by_key($args, 'taxonomies');
    $taxonomies = hocwp_sanitize_array($taxonomies);
    $taxonomies = hocwp_remove_empty_array_item($taxonomies);
    if (!hocwp_array_has_value($taxonomies) && empty($taxonomy)) {
        $taxonomy = 'category';
    }
    $taxonomies[] = $taxonomy;
    $taxonomies = hocwp_sanitize_array($taxonomies);
    $options = isset($args['options']) ? $args['options'] : array();
    $force_empty = isset($args['force_empty']) ? (bool) $args['force_empty'] : false;
    $tax = get_taxonomy($taxonomy);
    if (!$force_empty) {
        if (!hocwp_array_has_value($taxonomies) && !hocwp_array_has_value($options)) {
            _e('Please pass a taxonomy or set options for arguments.', 'hocwp-theme');
            return;
        }
    }
    $only_parent = isset($args['only_parent']) ? $args['only_parent'] : false;
    $id = isset($args['id']) ? $args['id'] : '';
    $name = isset($args['name']) ? $args['name'] : '';
    $field_class = isset($args['field_class']) ? $args['field_class'] : '';
    if (is_object($tax)) {
        hocwp_add_string_with_space_before($field_class, 'select-' . $tax->rewrite['slug'] . '-terms');
    }
    $args['field_class'] = hocwp_add_string_with_space_before($field_class, 'select-term');
    $label = isset($args['label']) ? $args['label'] : '';
    $value = isset($args['value']) ? $args['value'] : '';
    $description = isset($args['description']) ? $args['description'] : '';
    $taxonomy_id = isset($args['taxonomy_id']) ? $args['taxonomy_id'] : '';
    $taxonomy_name = isset($args['taxonomy_name']) ? $args['taxonomy_name'] : '';
    $show_count = isset($args['show_count']) ? $args['show_count'] : true;
    $load_item = isset($args['load_item']) ? (bool) $args['load_item'] : true;
    $option_default = '';
    if (isset($args['option_default'])) {
        $option_default = $args['option_default'];
    } else {
        $default_text = isset($args['default_text']) ? $args['default_text'] : __('Choose term');
        $option_default = '<option value="0" data-taxonomy="">-- ' . $default_text . ' --</option>';
    }
    $all_option = $option_default;
    if ($load_item) {
        $options = wp_parse_args($options, $taxonomies);
        $options = hocwp_sanitize_array($options);
        if (hocwp_array_has_value($options)) {
            foreach ($options as $tax) {
                if (!is_object($tax)) {
                    $tax = get_taxonomy($tax);
                }
                $term_args = array();
                if ($only_parent) {
                    $term_args['parent'] = 0;
                }
                if (!is_object($tax)) {
                    continue;
                }
                $terms = hocwp_get_terms($tax->name, $term_args);
                if (hocwp_array_has_value($terms)) {
                    $show_count = isset($args['show_count']) ? $args['show_count'] : true;
                    $hirachical = isset($args['hirachical']) ? $args['hirachical'] : true;
                    $option_group = isset($args['option_group']) ? $args['option_group'] : true;
                    $select_args = array('selected' => $value, 'taxonomy' => $tax->name, 'show_count' => $show_count, 'hirachical' => $hirachical);
                    $select = hocwp_get_term_drop_down($select_args);
                    $select = hocwp_remove_select_tag_keep_content($select);
                    $tmp = '';
                    if (!empty($select)) {
                        if ($option_group) {
                            $tmp = '<optgroup label="' . $tax->labels->singular_name . '" data-taxonomy="' . $tax->name . '">';
                            $tmp .= $select;
                            $tmp .= '</optgroup>';
                        } else {
                            $tmp .= $select;
                        }
                    }
                    $all_option .= $tmp;
                }
            }
        }
    }
    $args['all_option'] = $all_option;
    $args['label'] = $label;
    if (!isset($args['attributes']['data-taxonomy'])) {
        $args['attributes']['data-taxonomy'] = $taxonomy;
    }
    $args['attributes']['data-show-count'] = absint($show_count);
    hocwp_field_select($args);
}
Example #7
0
function hocwp_breadcrumb($args = array())
{
    if (is_home()) {
        return;
    }
    $before = hocwp_get_value_by_key($args, 'before');
    $after = hocwp_get_value_by_key($args, 'after');
    if (function_exists('yoast_breadcrumb') && hocwp_wpseo_breadcrumb_enabled()) {
        yoast_breadcrumb('<nav class="hocwp-breadcrumb breadcrumb yoast clearfix">' . $before, $after . '</nav>');
        return;
    }
    if (hocwp_wc_installed()) {
        if (empty($before)) {
            $before = '<div class="hocwp-breadcrumb breadcrumb">';
            $after = '</div>';
        }
        echo $before;
        woocommerce_breadcrumb($args);
        echo $after;
        return;
    }
    global $post;
    $separator = isset($args['separator']) ? $args['separator'] : '/';
    $breadcrums_id = isset($args['id']) ? $args['id'] : 'hocwp_breadcrumbs';
    $home_title = __('Home', 'hocwp-theme');
    $custom_taxonomy = 'product_cat';
    $class = isset($args['class']) ? $args['class'] : '';
    $class = hocwp_add_string_with_space_before($class, 'list-inline list-unstyled breadcrumbs');
    if (!is_front_page()) {
        echo '<div class="hocwp-breadcrumb breadcrumb default clearfix">';
        echo '<ul id="' . $breadcrums_id . '" class="' . $class . '">';
        echo '<li class="item-home"><a class="bread-link bread-home" href="' . get_home_url() . '" title="' . $home_title . '">' . $home_title . '</a></li>';
        echo '<li class="separator separator-home"> ' . $separator . ' </li>';
        if (is_post_type_archive()) {
            echo '<li class="item-current item-archive"><strong class="bread-current bread-archive">' . post_type_archive_title('', false) . '</strong></li>';
        } elseif (is_archive() && is_tax() && !is_category()) {
            $post_type = get_post_type();
            if ($post_type != 'post') {
                $post_type_object = get_post_type_object($post_type);
                $post_type_archive = get_post_type_archive_link($post_type);
                if (is_object($post_type_object)) {
                    echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
                    echo '<li class="separator"> ' . $separator . ' </li>';
                }
            }
            if (is_search()) {
                echo '<li class="item-current item-current-' . get_search_query() . '"><strong class="bread-current bread-current-' . get_search_query() . '" title="Search results for: ' . get_search_query() . '">Search results for: ' . get_search_query() . '</strong></li>';
            } else {
                $custom_tax_name = get_queried_object()->name;
                echo '<li class="item-current item-archive"><strong class="bread-current bread-archive">' . $custom_tax_name . '</strong></li>';
            }
        } elseif (is_single()) {
            $post_type = get_post_type();
            if ($post_type != 'post') {
                $post_type_object = get_post_type_object($post_type);
                $post_type_archive = get_post_type_archive_link($post_type);
                echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
                echo '<li class="separator"> ' . $separator . ' </li>';
            }
            $category = get_the_category();
            $array_values = array_values($category);
            $last_category = end($array_values);
            $get_cat_parents = '';
            if (is_object($last_category)) {
                $get_cat_parents = rtrim(get_category_parents($last_category->term_id, true, ','), ',');
            }
            $cat_parents = explode(',', $get_cat_parents);
            $cat_display = '';
            foreach ($cat_parents as $parents) {
                $cat_display .= '<li class="item-cat">' . $parents . '</li>';
                $cat_display .= '<li class="separator"> ' . $separator . ' </li>';
            }
            $taxonomy_exists = taxonomy_exists($custom_taxonomy);
            if (empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) {
                $taxonomy_terms = get_the_terms($post->ID, $custom_taxonomy);
                if (isset($taxonomy_terms[0]) && is_a($taxonomy_terms[0], 'WP_Term')) {
                    $cat_id = $taxonomy_terms[0]->term_id;
                    $cat_nicename = $taxonomy_terms[0]->slug;
                    $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
                    $cat_name = $taxonomy_terms[0]->name;
                }
            }
            if (!empty($last_category)) {
                echo $cat_display;
                echo '<li class="item-current item-' . $post->ID . '"><strong class="bread-current bread-' . $post->ID . '" title="' . get_the_title() . '">' . get_the_title() . '</strong></li>';
            } elseif (!empty($cat_id)) {
                echo '<li class="item-cat item-cat-' . $cat_id . ' item-cat-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . $cat_link . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
                echo '<li class="separator"> ' . $separator . ' </li>';
                echo '<li class="item-current item-' . $post->ID . '"><strong class="bread-current bread-' . $post->ID . '" title="' . get_the_title() . '">' . get_the_title() . '</strong></li>';
            } else {
                echo '<li class="item-current item-' . $post->ID . '"><strong class="bread-current bread-' . $post->ID . '" title="' . get_the_title() . '">' . get_the_title() . '</strong></li>';
            }
        } elseif (is_category()) {
            echo '<li class="item-current item-cat"><strong class="bread-current bread-cat">' . single_cat_title('', false) . '</strong></li>';
        } elseif (is_page()) {
            if ($post->post_parent) {
                $anc = get_post_ancestors($post->ID);
                $anc = array_reverse($anc);
                $anc = array_reverse($anc);
                $parents = '';
                foreach ($anc as $ancestor) {
                    $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
                    $parents .= '<li class="separator separator-' . $ancestor . '"> ' . $separator . ' </li>';
                }
                echo $parents;
                echo '<li class="item-current item-' . $post->ID . '"><strong title="' . get_the_title() . '"> ' . get_the_title() . '</strong></li>';
            } else {
                echo '<li class="item-current item-' . $post->ID . '"><strong class="bread-current bread-' . $post->ID . '"> ' . get_the_title() . '</strong></li>';
            }
        } elseif (is_tag()) {
            $term_id = get_query_var('tag_id');
            $taxonomy = 'post_tag';
            $args = 'include=' . $term_id;
            $terms = hocwp_get_terms($taxonomy, $args);
            if (hocwp_array_has_value($terms)) {
                echo '<li class="item-current item-tag-' . $terms[0]->term_id . ' item-tag-' . $terms[0]->slug . '"><strong class="bread-current bread-tag-' . $terms[0]->term_id . ' bread-tag-' . $terms[0]->slug . '">' . $terms[0]->name . '</strong></li>';
            }
        } elseif (is_day()) {
            echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
            echo '<li class="separator separator-' . get_the_time('Y') . '"> ' . $separator . ' </li>';
            echo '<li class="item-month item-month-' . get_the_time('m') . '"><a class="bread-month bread-month-' . get_the_time('m') . '" href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</a></li>';
            echo '<li class="separator separator-' . get_the_time('m') . '"> ' . $separator . ' </li>';
            echo '<li class="item-current item-' . get_the_time('j') . '"><strong class="bread-current bread-' . get_the_time('j') . '"> ' . get_the_time('jS') . ' ' . get_the_time('M') . ' Archives</strong></li>';
        } elseif (is_month()) {
            echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
            echo '<li class="separator separator-' . get_the_time('Y') . '"> ' . $separator . ' </li>';
            echo '<li class="item-month item-month-' . get_the_time('m') . '"><strong class="bread-month bread-month-' . get_the_time('m') . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</strong></li>';
        } elseif (is_year()) {
            echo '<li class="item-current item-current-' . get_the_time('Y') . '"><strong class="bread-current bread-current-' . get_the_time('Y') . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</strong></li>';
        } elseif (is_author()) {
            global $author;
            $userdata = get_userdata($author);
            echo '<li class="item-current item-current-' . $userdata->user_nicename . '"><strong class="bread-current bread-current-' . $userdata->user_nicename . '" title="' . $userdata->display_name . '">' . 'Author: ' . $userdata->display_name . '</strong></li>';
        } elseif (get_query_var('paged')) {
            echo '<li class="item-current item-current-' . get_query_var('paged') . '"><strong class="bread-current bread-current-' . get_query_var('paged') . '" title="Page ' . get_query_var('paged') . '">' . __('Page') . ' ' . get_query_var('paged') . '</strong></li>';
        } elseif (is_search()) {
            echo '<li class="item-current item-current-' . get_search_query() . '"><strong class="bread-current bread-current-' . get_search_query() . '" title="Search results for: ' . get_search_query() . '">Search results for: ' . get_search_query() . '</strong></li>';
        } elseif (is_404()) {
            echo '<li>' . __('Error 404', 'hocwp-theme') . '</li>';
        }
        echo '</ul>';
        echo '</div>';
    }
}
Example #8
0
function hocwp_get_child_terms($parent_id, $taxonomy, $args = array())
{
    if (is_a($parent_id, 'WP_Term') && (is_array($taxonomy) || null == $taxonomy)) {
        $taxonomy = $parent_id->taxonomy;
        if (is_array($taxonomy)) {
            $args = $taxonomy;
        }
        $parent_id = $parent_id->term_id;
    }
    $args['child_of'] = $parent_id;
    $terms = hocwp_get_terms($taxonomy, $args);
    return $terms;
}