Pagination on home.php | WordPress.org

[ad_1]

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]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer