function jhp_get_the_category($post = null)
{
    _deprecated_function(__FUNCTION__, '0.9.8', 'hmp_get_the_category()');
    return hmp_get_the_category($post);
}
Пример #2
0
/**
 * @see the_category()
*/
function hmp_the_category($separator = '', $parents = '', $post = null)
{
    if ($post === null) {
        global $post;
    }
    if (!is_numeric($post)) {
        $post = $post->ID;
    }
    $categories = hmp_get_the_category($post);
    $thelist = '';
    if ('' == $separator) {
        $thelist .= '<ul class="post-categories">';
        foreach ($categories as $category) {
            $thelist .= "\n\t<li>";
            switch (strtolower($parents)) {
                case 'single':
                    $thelist .= '<a href="' . hmp_get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all entries in %s"), $category->name)) . '">';
                    if ($category->parent) {
                        $thelist .= get_category_parents($category->parent, false, $separator);
                    }
                    $thelist .= $category->name . '</a></li>';
                    break;
                case '':
                default:
                    $thelist .= '<a href="' . hmp_get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all entries in %s"), $category->name)) . '">' . $category->cat_name . '</a></li>';
            }
        }
        $thelist .= '</ul>';
    } else {
        $i = 0;
        foreach ($categories as $category) {
            if (0 < $i) {
                $thelist .= $separator . ' ';
            }
            switch (strtolower($parents)) {
                case 'single':
                    $thelist .= '<a href="' . hmp_get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all entries in %s"), $category->name)) . '">';
                    $thelist .= "{$category->cat_name}</a>";
                    break;
                case '':
                default:
                    $thelist .= '<a href="' . hmp_get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all entries in %s"), $category->name)) . '">' . $category->name . '</a>';
            }
            ++$i;
        }
    }
    return apply_filters('the_category', $thelist, $separator, $parents);
}