Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

SS3/blog sort order and pagination

Go to End



Community Member, 130 Posts

15 September 2012 at 10:53am

Edited: 15/09/2012 12:26pm

I'm having an issue getting both sort order and limited pagination both working with latest blog module.

I've extended the BlogHolder and BlogEntry:
WorkHolder extends BlogHolder{}
WorkEntry extends BlogEntry{}

In my _config file I have:


And if I use this in my WorkHolder template, everything works fine. The list limits to 5 entries and the pager at the bottom of the posts works as expected:

<% loop BlogEntries %>


If I change the sort order like this (or whatever I sort by):

<% loop BlogEntries.sort('Sort','ASC') %>

The order changes as expected, but the pagination no longer works. I get the pagination at the bottom of the blog list (e.g., '1 2 Next') but I also get every blog post on every page. So if I have 7 blog posts, I get all seven on page 1 and all seven on page 2.

I also tried doing something like this in my controller:

    public function sortedChildren() {
        $workentry = WorkEntry::get()->sort('Sort', 'ASC');
        return $workentry;

And looping through the sortedChildren, but that has the same issue.

Can someone tell me if this is not possible or what I'm missing or point me in the right direction?

Also, adding static $default_sort = 'Sort ASC'; to my WorkEntry class, ordered by SiteTree not SiteTree_Live.