I've got the following code which i found somewhere else i use it for pagination.
I don't understand all of it although I've read codex.wordpress.org/Class_Reference/WP_Query several times. they seem to speak about new queries.
global $wp_query, $wp_rewrite, $numposts;
$wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
$pagination = array(
'base' => @add_query_arg('page','%#%'),
'format' => '',
'total' => $wp_query->max_num_pages,
'current' => $current,
'show_all' => false,
'mid_size' => 5,
'type' => 'plain',
'prev_next' => True,
'prev_text' => __('[<< Prev]'),
'next_text' => __('[Next >>]'),
);
if ( $wp_rewrite->using_permalinks() )
$pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
if ( !empty($wp_query->query_vars['s']) )
$pagination['add_args'] = array( 's' => get_query_var( 's' ) );
Is there a way to change this so it will also sort the posts by lets say title or name or id or any other type of sorting ?
$posts = query_posts($query_string . '&orderby=title&order=asc');
is what i was looking for. Unless anyone knows of a better way ?