示例#1
0
/**
 * Return the pagination links for the current loop.
 *
 * See {@link paginate_links()} for the available options that you can use with this function.
 *
 * @since 4.0
 * @uses  $wp_rewrite
 * @uses  apply_filters() Applies 'wpsc_product_pagination_links'      filter.
 * @uses  apply_filters() Applies 'wpsc_product_pagination_links_args' filter.
 * @uses  home_url()
 * @uses  is_rtl()
 * @uses  paginate_links()
 * @uses  wp_parse_args()
 * @uses  WP_Rewrite::using_permalinks()
 * @uses  wpsc_get_current_page_number()
 *
 * @param  string|array $args Query string or an array of options.
 */
function wpsc_get_product_pagination_links($args = '')
{
    global $wp_rewrite, $wp_query;
    $base = '';
    if (wpsc_is_store()) {
        $base = home_url($wp_rewrite->root . wpsc_get_option('store_slug'));
    } elseif (wpsc_is_product_category()) {
        $base = wpsc_get_product_category_permalink();
    } elseif (wpsc_is_product_tag()) {
        $base = wpsc_get_product_tag_permalink();
    }
    if ($wp_rewrite->using_permalinks()) {
        $format = 'page/%#%';
    } else {
        $format = '?page=%#%';
    }
    $defaults = array('base' => trailingslashit($base) . '%_%', 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => wpsc_get_current_page_number(), 'prev_text' => is_rtl() ? __('→', 'wpsc') : __('←', 'wpsc'), 'next_text' => is_rtl() ? __('←', 'wpsc') : __('→', 'wpsc'), 'end_size' => 3, 'mid_size' => 2);
    $defaults = apply_filters('wpsc_get_product_pagination_links', $defaults);
    $r = wp_parse_args($args, $defaults);
    return apply_filters('wpsc_get_product_pagination_links', paginate_links($r));
}
示例#2
0
/**
 * Output a product tag's permalink.
 *
 * @since 4.0
 * @uses  wpsc_get_product_tag_permalink()
 *
 * @param  int|string|object $tag Optional. Either a term ID, term object or term slug. Defaults to the main product tag.
 */
function wpsc_product_tag_permalink($tag = '')
{
    echo wpsc_get_product_tag_permalink($tag);
}