function home_pagination( $query = null )
{
global $wp_rewrite;
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} elseif ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
$pagination = array(
'base' => @add_query_arg( 'paged', '%#%' ),
'format' => '',
'current' => $paged,
'total' => $query->max_num_pages,
'prev_text' => '« Previous',
'next_text' => 'Next »',
);
if ( $wp_ rewrite$wp_rewrite->using_permalinks() )
$pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ).'%#%''/%#%/', '' );
if ( ! empty( $wp_query->query_vars['s'] ) )
$pagination['add_args'] = array( 's' => get_query_var( 's' ) );
return paginate_links( $pagination );
}