In your template, you can use a query like this:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'page',
'meta_key' => '_wp_page_template',
'meta_value' => 'reviews',
'paged' => $paged
);
query_posts($args);
You may need to add other args, depending on your needs.
Thread Starter
pates
(@pates)
Thanks vtxy, I’ll check it out and let you know!
Thread Starter
pates
(@pates)
Ok, I’m completely lost at how I’m supposed to do this. My PHP ability is pretty minimal so a lot of this is way over my head.
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'page',
'meta_key' => '_wp_page_template',
'meta_value' => 'reviews',
'paged' => $paged
);
query_posts($args); ?>
This is in my page, but now what? This is what I am using at the moment which displays all the articles very well, it just doesn’t paginate:
<?php $args = array( 'numberposts' => 10, 'category' => 36, 'paged' => get_query_var('paged') ); ?>
<?php
global $post;
//$args = array( 'numberposts' => 5, 'offset'=> 1, 'category' => 1 );
$myposts = get_posts( $args );
$count = 0;
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php $countCheck = $count % 2; if ($countCheck == 1){ ?>
Any more help would be very kind!
You can add pagination with get_posts(), but it is much easier if you can use query_posts() instead.
Since I can’t see all your code, I can’t give exact instructions for making the change. In general terms, you want to replace the code I gave and the code you posted above, down to the endforeach; line with this:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'posts_per_page' => 10,
'category' => 36,
'post_type' => 'page',
'meta_key' => '_wp_page_template',
'meta_value' => 'reviews',
'paged' => $paged
);
query_posts($args);
if (have_posts()) :
$count = 0;
while (have_posts()) :
the_post(); ?>
// All the code between your foreach and endforeach goes here
<?php endwhile; endif; ?>
If you will put your code into a pastebin and post a link to it here, I may be able to give more exact instructions.