Liam88 Posted June 30, 2021 Share Posted June 30, 2021 Hoping someone can help. I have pagination all set up with the usual steps: Make sure "markuppagernav" is installed Allow page numbers on the template Create a page query that selects a limited number of items. renderpager the items query. <?php namespace ProcessWire; $all = $page->children("template='blog-post', sort=-published"); $featured = $all->find("limit=4, check_featured!={$page->check_featured}"); $items = $all->find("limit=6"); ?> I have more than 6 posts to ensure it would show. <?php echo $items->renderPager([ 'listMarkup' => '<nav aria-label="navigation"><ul class="pagination">{out}</ul></nav>', 'itemMarkup' => '<li class="page-item {class}">{out}</li>', 'linkMarkup' => '<a class="page-link" href="{url}">{out}</a>', 'currentLinkMarkup' => '<a class="page-link" href="{url}">{out}</a>', 'currentItemClass' => "active" ]); ?> Then the above at the bottom of the page. As mentioned the page numbers are enabled: If I manually add in example.com/blog/page2/ then I just get the same output like example.com/blog/ Where am I going wrong? TIA Link to comment Share on other sites More sharing options...
3fingers Posted June 30, 2021 Share Posted June 30, 2021 $featured = $all->find("limit=4, check_featured!={$page->check_featured}"); // Just 4 results here $items = $all->find("limit=6"); // Cannot be 6 here Spot the mistake? Link to comment Share on other sites More sharing options...
Liam88 Posted June 30, 2021 Author Share Posted June 30, 2021 2 hours ago, 3fingers said: $featured = $all->find("limit=4, check_featured!={$page->check_featured}"); // Just 4 results here $items = $all->find("limit=6"); // Cannot be 6 here Spot the mistake? Hi, Thank you for the reply I get what you are thinking but I have the $all rule to then push into the two queries and neither $featured or $items reference each other. The pagination is only referencing the $items which are the main posts below. I have put an image below to show the layout which may help. Also, just to say I have removed the $featured query and the block above the breadcrumb and pagination still doesn't work. I have also removed the limit on $featured and use a count instead. Above the breadcrumb is $featured and below is $items Link to comment Share on other sites More sharing options...
Liam88 Posted June 30, 2021 Author Share Posted June 30, 2021 Just to add that no pagination renders which is odd. I have read many posts that have the render but have URL issues. Link to comment Share on other sites More sharing options...
Liam88 Posted July 1, 2021 Author Share Posted July 1, 2021 SORTED: So I changed item's to be the first query which featured then works off and now the pagination renders and works. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now