ridgedale

PW3 - Adding Pagination to Regular (Blog) Profile

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.

Share this post


Link to post
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>

 

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By sam-vital
      Hi,
      I'm creating a News/Updates section for a client and they would like the 3 most recent Updates previewed on the home screen. So this would be Title and Date Posted. These blog posts will be child pages of a News and Updates page, which is a child of the Home page. So it's like Home -> News -> Blog posts. I don't need this to be a nav menu, just something to show the newest updates.
      All help is appreciated 🙂
    • By j00st
      Hi all,

      I've set up a filter on my product-page, which I then use to...filter my products!
      – I've got pagination set up, and 30 items per page.
      – When I active the filter it works perfectly (in my opinion).
       
      Here's what I'm struggling with though:
      When I'm on another page (filtered as well/or the total overview) and I put my GET request in for the filter,
      it gives back the result, but still with the page-number there. In some cases, this is no problem – like a A-Z or Z-A filter,
      but others (say, per location) I might have less pages.
      Visual/code ref: (I DO have 3 pages of authors, but I don't have 3 pages from London)
      url: books/page3?author=ascending url: books/page3?studio=london  
      The current setup for my pages that get rendered are as follows:
      $allbooks = $pages->find("template=book, sort=$sort, $q, $tagged, $select_studio, start=0, limit=$limit"); As you can see I have the start=0 in there, but I read that's for the start of the pagination, not so much where it'll drop me in the search results.
      $q, $tagged and $select_studio are all empty values, unless they're returned from the GET request
      To repeat it, in it's most simplest form:
      When I click a filter, and a GET request is done, I want to 'reset' the page-number to 0, and get my results...
      Perhaps I'm missing something obvious, but I'd be really grateful to have your input.
    • By franciccio-ITALIANO
      Hi, in wordpress homepage we can put a list of LAST ARTICLES AND COMMENTS.
      Can I do same thing with processwire?
      If yes, how?
      There is a tutorial?

      Thanks!
    • By ridgedale
      Reference: PW 3.0.62 and uikit3 based site using the Regular-Master profile.
      I have a table that needs some of its content to be hidden. I've tried applying the following classes and styles to <tr>, <td> and <a> elements all without success:
      class="hidden" class="uk-hidden" class="uk-invisible" style="display:none" style="visibility:none" style="visibility:collapse" <-- only applicable to rows in this case Is there any way to allow a user to hide content? Any assistance would be appreciated.
    • By adrian_gp
      Hello everyone,
      I'm new in this forum and my english is not perfect so sorry for the mistakes.
      I have an Blog Project and i will use categories. 
      Here is the structure:
      Blog -> displays all the Blogposts (template=BlogPage) Post-Name -> display the specific Post (template=BlogPost) Categories -> not visible in the menu (template=CategoriesPage) Categorie-Name -> not visible in the menu (template=CategoriePage) For your information:
      (BlogPost) every blogpost has its own page (BlogPost) in Admin i can select the categorie per Field -> SelectMultiple Pages (Checkbox) (fieldname=categories) (Blog) displays all the BlogPosts and all the categories under the ParentTemplate CategoriesPage, which also have their own side Now the Problem:
      On Blog -> I would like to click on a category and only see the post that has this category checked in the BlogPost.
      CategoriePage -> what do I have to insert there to show only the specific posts which use the checked categorie?

      Let me know if you need more information

      Thanks for your support