Since it works on another page successfully, I don’t understand why it isn’t working for me here.
The problem is other page is not Static Front Page. When paging a static page, WordPress use the page
variable, not the paged
query variable. Pages use <!--nextpage-->
to paginate. From the WP_Query page:
Pagination Note: Use get_query_var(‘page’); if you want your query to work in a Page template that you’ve set as your static front page. The query variable ‘page’ also holds the pagenumber for a single paginated Post or Page that includes the
<!--nextpage-->
Quicktag in the post content.Display posts from current page on a static front page:
$paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
$query = new WP_Query( array( 'paged' => $paged ) );
In your code, this:
global $paged;
global $bday_parties;
$temp = $bday_parties;
$bday_parties = null;
$bday_parties = new WP_Query();
$bday_parties->query('category_name=party-themes&posts_per_page=1&post_type=page'.'&paged='.$paged);
while ($bday_parties->have_posts()) : $bday_parties->the_post();
Could be rewritten as this:
global $bday_parties;
$temp = $bday_parties;
$bday_parties = null;
$bday_parties = new WP_Query();
$page_number = ( get_query_var('page') ) ? get_query_var('page') : 1;
$bday_parties->query( 'category_name=party-themes&posts_per_page=1&post_type=page&page=" . $page_number );