rsi Posted July 22, 2021 Share Posted July 22, 2021 I'm pretty sure there is a simple way to configure PW to add new pages to the top of the list of already existing pages instead of the bottom - I simply can't find how and where to change the default setting. Thank you for your help! 1 Link to comment Share on other sites More sharing options...
bernhard Posted July 22, 2021 Share Posted July 22, 2021 You can define the sort settings for children in the parent's settings family tab. There you can select "created" and "reverse sort order" 1 Link to comment Share on other sites More sharing options...
rsi Posted July 23, 2021 Author Share Posted July 23, 2021 Oh, I see. I'll give it a try.. I thought this option would take away the manual sorting option. Thank you! Link to comment Share on other sites More sharing options...
bernhard Posted July 26, 2021 Share Posted July 26, 2021 Yes, it does. You didn't say anything about manual sorting ? See here and for some background here: Link to comment Share on other sites More sharing options...
Robin S Posted July 26, 2021 Share Posted July 26, 2021 @rsi you can use $pages->sort() to set the sort value of the new page to zero after it is added, and that will make it appear at the top of its siblings but still be manually sortable. In /site/ready.php: $pages->addHookAfter('added', function(HookEvent $event) { $pages = $event->object; // The page that is being added $page = $event->arguments(0); // If the page passes some kind of test if($page->template == 'news_item') { // Set the sort value for the new page to zero (sibling sort will be automatically adjusted) $pages->sort($page, 0); } }); 4 1 Link to comment Share on other sites More sharing options...
rsi Posted July 28, 2021 Author Share Posted July 28, 2021 Oh - WOW - Just as expected with processwire - there's a ton of options to get what I want!! Thank you 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