We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22427
    • 793 Posts
    Both the Wayfinder versions for Evo and Revo would not give the class last to a single ("only child") menu item (not having any siblings). For many users it's a natural expectation to get the class last for such an item too (as it is the case for the class first).

    The culprit for this behaviour is this condition within the function buildSubMenu in the file wayfinder.inc.php (line 93 in the Evo version, line 224 in the Revo version, counted by Notepad++):
    if ($counter == ($numSubItems) && $numSubItems > 1) {
    $docInfo['last'] = 1;
    } else {
    $docInfo['last'] = 0;
    }
    As a workaround the second part of the condition, $numSubItems > 1, should be omitted:
    if ( $counter == $numSubItems ) {
    $docInfo['last'] = 1;
    } else {
    $docInfo['last'] = 0;
    }

    To be even more flexible, two new boolean properties ( with values 0|1 ) would be desireable, e.g. &singleFirst and &singleLast.
    They have to determine if single items would get the class first (&singleFirst=`1`) or not (&singleFirst=`0`) - and similar for the class last.
    The default values both should be set to `1` (the natural choice, I think) - or, for the sake of downward compatibility, chosen to reflect the actual behaviour of Wayfinder.

    Edit:
    I also opened a Ticket for this: http://tracker.modx.com/issues/8537

    (Modified thread titel here - the " had eaten part of the line) [ed. note: ottogal last edited this post 11 years, 8 months ago.]
      • 38136
      • 42 Posts
      i just can support that. i messed around that in several modx installs.

      please include that in an update for wayfinder, in the package manager.

      thx
        • 23214
        • 36 Posts
        I just came across this issue (and this thread). ottogal's fix works for me.

        I'd just like to add a +1 to have this issue officially fixed. It seems logical that a single nav or subnav item should have both the firstClass and lastClass assigned. CSS can take over from there and you can style however you need:

        .first { ... }
        .first.last { ... }
        .last { ... }