Adding subtitles to autonav template

Permalink
Hello everyone.

I'm attempting to output the following code with the autonav template:

<nav>
<ul>
<li><a href="#">Link Title<div>link subtitle</div></a></li>
<li><a href="#">Link Title<div>link subtitle</div></a></li>
<li><a href="#">Link Title<div>link subtitle</div></a></li>
</ul>
</nav>


I've created a "subtitle" attribute for pages.
I want to change the autonav so that it automatically outputs the subtitle attribute wrapped in <div></div> tags. I've looked through the autonav template but don't know where to adjust things.

I think I need to use the following somewhere:
<?php echo $c->getAttribute('subtitle') ?>


Any help is greatly appreciated!
Thanks,
Dan

dcaryll
 
dcaryll replied on at Permalink Reply
dcaryll
Okay, I've gotten the subtitles to output, but it is displaying the subtitle from the next navigation item.

On line 78 I added:
$subtitle = $_c->getAttribute('subtitle');


On line 138 I added:
$navItem->subtitle = $subtitle;


And on line 236 I changed the output to this:
echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . $ni->name . '<div>' . $ni->subtitle .  '</div>' . '</a>';


Does anyone know what I need to change to make it display the page's attribute rather than another page's attribute?

Thanks,
Dan
dcaryll replied on at Permalink Best Answer Reply
dcaryll
Okay. I somehow got it working. Here's the code I used if anyone else is looking to do something similar:

<?php
//NOTE: For extra functionality, you can add the following page attributes (via Dashboard -> Pages and Themes -> Attributes):
//
// 1) Handle: replace_link_with_first_in_nav
//    Type: Checkbox
//    Functionality: If a page has this checked, clicking on it in the nav menu will go to its first child (sub-page) instead.
//
// 2) Handle: exclude_subpages_from_nav
//    Type: Checkbox
//    Functionality: If a page has this checked, all of that pages children (sub-pages) will be excluded from the nav menu (but the page itself will be included).
//
// 3) Handle: disable_link_in_nav
//    Type: Checkbox
//    Functionality: If a page has this checked, it will appear in the nav menu but will not be "clickable" (will not link to any page).
//