Pagination on home.php
-
Hi everyone! I’m trying my hand at pagination and for the most part everything is working fine except:
My pagination is querying a custom_post_type named arizona_wine. Posts per page is set at 1 (so I can cycle the pagination to make sure it works) but when I click page 2, it says “page not found” on my firefox tab.
On home.php I have a tab called “All” which pulls in custom post types ‘arizona_wine’ and ‘arizona_beer’. The pagination works there, but when I go to the archive-arizona_wine.php and use the pagination it isn’t working as it does on home.php.
The code on home.php is below – Will this code not work on archive-(archive name).php
$currentpage = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array(
'posts_per_page' => 12,
'post_type' => array('arizona_wine', 'arizona_beer'),
'orderby' => 'title',
'order' => 'ASC',
'paged' => $currentpage
);
$all_posts = new WP_Query($args);then the loop – then
$big = 999999999;
echo paginate_links(
array(
'base' => str_replace($big, '%#%', get_pagenum_link($big)),
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $all_posts -> max_num_pages,
'prev_text' => ('Previous'), 'next_text' => ('Next'),
)
);The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.