Hello everyone,
i have written a simple function to render the Navigation for my "Onepager"
Here is the code:
<?php
function renderOnepagenav($onepageroot) {
$sections = $onepageroot->children;
echo "<ul>";
$id = '';
foreach ($sections as $item) {
$id ++;
echo "<li><a href='#section-$id'>$item->title</a></li>";
}
echo "</ul>";
}
Every Sektion is a child-page of home in the backend.
It works fine but i would like to add two modifications, where i need your help:
1. i would like to skip the first (child-)page.
2. I would like to add a class only to the first rendered <li> Element.
All kind of advice is highly appreciated.
Thank you,
Gregor