Hot answers tagged

3

As I far I know, get_posts() function can not be used to paginated results. It is intended to get an array of posts and it sets no_found_rows to true by default from WP 3.1. Pagination won't work unless you set it to false, or better, use WP_Query. numberposts is also a invalid argument. $paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1; ...


2

Here's a workaround: First change the paginate_links() output type to: 'type' => 'array', Then we can collect the previous, current and next parts from the paginate_links() output. Here's a simple example where we target the relevant classes: $next = ''; $current = ''; $prev = ''; foreach( (array) $paginate_links as $link ) { ...


1

You are setting null to $wp_query then querying get_query_var( 'paged' ) this is expected that you will get this error! First query get_query_var( 'paged' ) then set the original $wp_query to null Example:- $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; global $wp_query; $temp = $wp_query; $wp_query = new WP_Query( ...


1

You need to set your paged arg in your $args array: $listing_args = array( 'post_type' => 'business', 'posts_per_page' => 10, 'meta_key' => 'listing_num', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'offset' => ($paged -1) * 10, 'paged' => ...


1

Got it to work, changing the regex from (.+) to (.*) Maybe helpful for others searching same rewrite on search and pagination. add_rewrite_rule('discover/interiors/interior-results/(.*)/page/([0-9]{1,})/?', 'index.php?pagename=discover/interiors/interior-results&tag1=$matches[1]&paged=$matches[2]', 'top' ); ...



Only top voted, non community-wiki answers of a minimum length are eligible