need to add a post limit and pagenation to this query
-
need to add a post limit of 15 per page and pagination to this query… thx in advance
<?php $querystr = " SELECT wposts.*, ABS( REPLACE(SUBSTRING(wpostmeta.meta_value, 2) , ',', '')) AS sortby FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'price' AND wpostmeta.meta_value != '$TBA' AND wpostmeta.meta_value != 'REQUEST $' AND ABS(REPLACE(REPLACE(wpostmeta.meta_value, '$', ''), ',', '')) > '150' AND ABS(REPLACE(REPLACE(wpostmeta.meta_value, '$', ''), ',', '')) < '500' AND post_status='publish' ORDER BY sortby asc "; $pageposts = $wpdb->get_results($querystr, OBJECT); if ($pageposts) : foreach ($pageposts as $post): setup_postdata($post); $my_meta = get_post_meta(get_the_ID(), '_my_meta', TRUE); ?> <?php get_template_part( 'grid', get_post_format() ); ?> <?php endforeach; endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘need to add a post limit and pagenation to this query’ is closed to new replies.