Functions/nav

< Functions(Redirected from Theme API/nav)

The nav() helper function generates an unordered list of navigation links on your theme. HTML list items will be given a class of "current" for any links corresponding to the current page.

When creating navigation on your public theme, use the public_nav_main() helper instead of nav. The difference between nav() and public_nav() is that plugins (including SimplePages) are able to dynamically add or remove links from the navigation in public_nav().

Arguments:

  • $links: array Key = Text of Navigation, Value = Link

Example

The following code creates navigation both the Items and Exhibits pages, and uses the uri() function to build dynamic links to pages within Omeka.:

<ul class="navigation"
<?php echo nav(
             array( 
               'Items' => uri('items'),
               'Exhibits' => uri('exhibits')
             )
           ); 
?>
</ul>

And the following HTML is produced:

<ul class="navigation">
<li class="nav-items current">
  <a href="http://example.com/omeka/items">Items</a></li>
<li class="nav-exhibits">
  <a href="http://example.com/omeka/exhibits">Exhibits</a></li>
</ul>