function custom_page_navi( $totalpages, $page, $end_size, $mid_size )
{
$bignum = 999999999;
if ( $totalpages <= 1 || $page > $totalpages ) return;
return paginate_links( array(
'base' => str_replace( $bignum, '%#%', esc_url( get_pagenum_link( $bignum ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, $page ),
'total' => $totalpages,
'end_size' => $end_size,
'mid_size' => $mid_size
) );
}
function clpr_store_list_page( $args = array() ) {
$taxonomy = APP_TAX_STORE;
$number = 8;
// Setup:
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$offset = ( $paged > 0 ) ? $number * ( $paged - 1 ) : 1;
$totalterms = wp_count_terms( $taxonomy, array( 'hide_empty' => false ) );
$totalpages = ceil( $totalterms / $number );
// Get the top categories that belong to the provided taxonomy (the ones without parent)
$defaults = array(
'taxonomy' => 'category',
'menu' => true,
'count' => true,
'top_link' => true,
'include' => array(),
'class' => 'terms',
);
$options = wp_parse_args( (array) $args, $defaults );
$options = apply_filters( 'clpr_terms_list_args', $options );
$stores = get_terms( $options['taxonomy'],
array(
'parent' => 0, // <-- No Parent
'orderby' => 'title',
'hide_empty' => false,
'number'=>$number,
'offset' => $offset,
)
);
// Iterate through all stores to display each individual category
foreach ( $stores as $store ) {
$list = '';
$store_id = $store->term_id;
$store_name = $store->name;
$store_img = clpr_get_store_image_url( $store->term_id, 'term_id', 250 );
$list .= '<div class="store-items">';
$list .= '<a href="'.get_term_link( $store, $taxonomy ).'">';
$list .= html('img class="store-img" src="'.$store_img.'"alt="logo"');
$list .= '</a>';
$list .= html('a href="'.get_term_link( $store, $taxonomy ).'"',$store_name);
$list .='</div>';
echo $list;
}
echo custom_page_navi($totalpages,$paged,1,3);
}
There are currently 1 users browsing this thread. (0 members and 1 guests)