Jump to content

PW3 - Adding Pagination to Regular (Blog) Profile


ridgedale
 Share

Recommended Posts

I'm in the process of finalising a pw 3.0.62 and uikit3 based site which using the Reglar-Master profile and I've noticed pagination is missing despite the Allow Page Numbers? setting being enabled under the blog template URLs tab.

The default blog.php template is as below:

<div id='content'>
	<?php
	echo ukHeading1(page()->title, 'divider'); 
	$posts = page()->children('limit=10');
	echo ukBlogPosts($posts); 
	?>
</div>

Reducing the limit as follows does not result in any pagination being displayed despite there being 10 news posts.

...
	$posts = page()->children('limit=6');
...

If I have understood correctly, it should not be necessary to add the MarkupPagerNav module to this profile as the capability should already be already built-in.

If that is the case, then I can only think that some additional code is required.

Any help would be greatly appreciated.

Link to comment
Share on other sites

@ridgedale Add this function to blog.php from the _uikit.php file line no.537

echo ukPagination($posts);

Your file blog.php should look like below:

<?php namespace ProcessWire;
// This is the template file for main /blog/ page that lists blog post summaries.
// If there are more than 10 posts, it also paginates them.
?>

<div id='content'>
	<?php
	echo ukHeading1(page()->title, 'divider');
// LIMIT POSTS TO SHOW PAGINATION
	$posts = page()->children('limit=2');
	echo ukBlogPosts($posts);

// ADD THIS CODE INTO blog.php from _uikit.php line => 537
	echo ukPagination($posts);
	?>
</div>

<aside id='sidebar'>
	<?php
	$categories = pages()->get('/categories/');
	echo ukNav($categories->children, [ 'header' => $categories->title ]);
	?>
</aside>

 

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...