Show page id in autonav class

Permalink
Hi, I am working on a custom template for my autonav menu and I need each page ID to be a class for its li element. How can I do this?
I have had a quick google but can't find anything.
Thanks.

echo '<a a href="' . ($ni->level == 2 && $ni->hasSubmenu ? '#' : $ni->url) . '" target="' . $ni->target . '" class="' . $ni->classes . '">';
        echo '<li class="' . $ni->classes . '"><span>';

 
MrKDilkington replied on at Permalink Best Answer Reply
MrKDilkington
Hi wbargent,

This will add the collection ID (page ID) as a class for the li element.

The ternary operator for the classes property is added to remove the extra space if it is false.
echo '<li class="' . ($ni->classes ? $ni->classes . ' ' : '') . $ni->cID . '">';