Docs X - Re-ordering the pages in sidebar
Hi Edit,
I was not able to find a solution for my problem.
I have something like this:
So as you can see, Home is a parent category that has a child: Team and Welcome.
The Welcome page has order set by 1 and Team set by 2 but somehow the website shows the Team as 1st and Welcome as 2nd. How can I change it?
I have also found a bug. I thought I should create a websites as static, but it allows me to create only the link to horizontal navbar, not sidebar. After I moved the parent with some child from static to default (pages), I was able to see parent only. The child are disappeared
Edit:
Ok I found the solutions. In the settings of Bludit there is a need to change the order of displaying post from date to position.
Greetings
I was not able to find a solution for my problem.
I have something like this:
So as you can see, Home is a parent category that has a child: Team and Welcome.
The Welcome page has order set by 1 and Team set by 2 but somehow the website shows the Team as 1st and Welcome as 2nd. How can I change it?
I have also found a bug. I thought I should create a websites as static, but it allows me to create only the link to horizontal navbar, not sidebar. After I moved the parent with some child from static to default (pages), I was able to see parent only. The child are disappeared
Edit:
Ok I found the solutions. In the settings of Bludit there is a need to change the order of displaying post from date to position.
Greetings
Hi I made a simple function for ordering subpages by "position" number:
add this function to init.php in Your theme and call simple like that in template php file:
Code: Select all
function renderChildrenListSorted($parentPage) {
$out = '';
$childrenSorted = [];
if ($parentPage->hasChildren()) {
$out .= '<ul>';
$children = $parentPage->children();
foreach ($children as $ch) {
$position = $ch->getValue('position');
$childrenSorted[$position] = $ch;
}
ksort($childrenSorted);
foreach ($childrenSorted as $child) {
$out .= '<li>';
$out .= ' <a href="'.$child->permalink().'">'.$child->title().'</a>';
$out .= '</li>';
}
$out .= '</ul>';
}
return $out;
}
Code: Select all
echo renderChildrenListSorted($page);