Page link functions depend on the value in the $paged
global variable. So, we need to update that variable as well as the parameter in the custom query.
If we are on a “static” front page, the 'paged'
query variable should be undefined and the 'page'
query variable may be defined.
If neither query variable is defined we are probably on page 1.
// Only needed if this code is called via a function.
global $paged;
if ( get_query_var( 'paged' ) )
// On a paged page.
$paged = get_query_var( 'paged' );
else if ( get_query_var( 'page' ) )
// On a "static" page.
$paged = get_query_var( 'page' );
else
// Default.
$paged = 1;
$args = array(
'post_type' => 'property',
'orderby' => 'meta_value',
'meta_key' => 'random_775',
'order' => 'ASC',
'paged' => $paged,
'posts_per_page' => 10,
);
Code adapted from the Pagination WordPress Codex page.
EDIT:
$count = 0;
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) :
$loop->the_post();
next_posts_link( 'Next', $loop->max_pages );
previous_posts_link( 'Back' );