Pagination with custom queries possible?
-
I’m using a custom query in order to show only posts with a certain custom field value. See below:
<?php $querystr = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'imagetype' AND wpostmeta.meta_value = 'photoshop' AND wposts.post_status = 'publish' AND wposts.post_type = 'post' ORDER BY wposts.post_date DESC "; $pageposts = $wpdb->get_results($querystr, OBJECT); if ($pageposts): foreach ($pageposts as $post): setup_postdata($post); ?>
I want to add pagination to it since this query will show all entries (like 400+ and that’s a bit too much to load). Is there a way to combine above code with posts_per_page option like below?
<?php query_posts('posts_per_page=48' . '&orderby=modified&paged=' . get_query_var('paged')); ?>
Maybe possible with other query? I also tried to set the maximum post ammount, but the custom query overrides it and there is no pagination what so ever.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Pagination with custom queries possible?’ is closed to new replies.