DrQuincy Posted Friday at 10:07 AM Share Posted Friday at 10:07 AM I have a template that has a date field attached to it and I use this to reverse sort items. This works great for my blog feed. However, I want to use the same template for an events field. To save me managing an entirely separate template, is there a hook I can use that will uncheck the “reverse sort” checkbox dyanically? So: /blog/ sorts children per the template settings, most recent first /events/ uses a hook to display pages date order ascending Note I am only referring to the site tree in the admin. Obviously, on the front end I can easily use selectors to get the desired result. Thanks. Link to comment Share on other sites More sharing options...
da² Posted Friday at 01:28 PM Share Posted Friday at 01:28 PM Hi, You don't need a hook, you can sort children on the parent page: Link to comment Share on other sites More sharing options...
DrQuincy Posted Friday at 01:33 PM Author Share Posted Friday at 01:33 PM Thanks but I want to use different sorting dynamically though to avoid adding a separate template. One is news, most recent first. The other is events where the date would be ascending since the dates would be in the future. I hope that makes sense. Link to comment Share on other sites More sharing options...
da² Posted Friday at 02:14 PM Share Posted Friday at 02:14 PM (edited) Yes, you can do it by changing the parent page template sorting option. The child template doesn't change, only the sort option on parent page template. /blog/ sorts children: most recent first /events/ sorts children: date order ascending Edited Friday at 02:22 PM by da² 1 Link to comment Share on other sites More sharing options...
DrQuincy Posted 4 hours ago Author Share Posted 4 hours ago Yes, good point, I don't need two different child templates. Thanks. 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