Docs X - Re-ordering the pages in sidebar

Post Reply
kaaleth
Master Bludit
Posts: 117
Joined: Sun Jun 14, 2015 9:55 am

Hi,

how can I reorder the page positions inside of sidebar? I have changed the position of the content but the pages are still messy. I would like to sort them somehow.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Please see the following post:

viewtopic.php?p=7612#p7612

This works with default content.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
kaaleth
Master Bludit
Posts: 117
Joined: Sun Jun 14, 2015 9:55 am

Hi Edit,

I was not able to find a solution for my problem.

I have something like this:
menu.png
menu.png (2.33 KiB) Viewed 4511 times
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 :shock:

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
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

kaaleth wrote: Mon May 10, 2021 9:02 pm In the settings of Bludit there is a need to change the order of displaying post from date to position.
Sorry, I should have mentioned that.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
miloslav
Jr. Bludit
Posts: 1
Joined: Thu Aug 04, 2022 1:38 pm

Hi I made a simple function for ordering subpages by "position" number:

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;
    }
add this function to init.php in Your theme and call simple like that in template php file:

Code: Select all

echo renderChildrenListSorted($page);
Post Reply