Update: but itâs probably wrong, as subpages are acting like pages: https://take.ms/gDmnwo
I am so frustrated, trying to find instructions, but they seem to lack details. For example in cookbook there is article about custom post types, but it shows output, and no step by step instruction how to create custom post type https://getkirby.com/docs/cookbook/templating/custom-post-types
It was from panel, where all pages are listed. Seems very hard to understand for me, so I just copied all that I had for blog section, which works fine, and now projects seems to work
But another question: which code would show the list of projects on Projects page? I mean what should be in /templates/projects.php?
Thank you, itâs working! Also can you please help to understand, how to change this: when I am ready to publish Project, its position by default is last. I can do it first manually, but if itâs 100 projects, thatâs not convenient, also normally newest project should be displayed first. So how can I change this setting and show newest Project first by default?
And also is it compulsory for any page or subpage to have this Draft stage? Or it can be set to be published straight?
The draft state is compulsory, but you can use hooks to auto-publish pages directly after creation, in this case it would be the page.create:after hook.
If you use a date field in your projects, you could switch from (manual) sorting by number to sorting by date: Page blueprint | Kirby CMS
Thank you, tried this sorting by date and itâs working: num: '{{ page.created.toDate("Ymd") }}'
Yes, same sort should be in panel and on frontpage.
Still, sometimes there will be need of additional manual sorting, so is it possible to have sorting by âdate createdâ by default, plus this: https://take.ms/jNbT7?
Or can be different: can be manual sorting, only that by default should be number 1.
Date based sorting doesnât work with manual sorting, it just wouldnât make sense. If you want manual sorting, you have to use standard numbered sorting. Theoretically, there is no need to set the default number for new pages to 1, because you can simply flip the order (using desc or asc or flip()) to get the desired result.
Please note that sorting the pages manually by dragging them with those handels actually changing the folder number.
Thank you! Working. First I confused with code for multiple fields. Also interesting, that itâs working with this code too:
<?php
$projects = page(âprojectsâ)->children()->listed()->sortBy(function ($page) {
return $page->date()->date();
}, âdescâ);
foreach($projects as $project): ?>