Exhibit builder page nav

exhibit_builder_page_nav returns an list of pages for a given section, using an unordered list HTML element. The helper function includes an argument to use the page title or number for the link text.

Usage

<?php exhibit_builder_page_nav($section = null, $linkTextType='title'); ?>

Arguments

  • section: The section for which you'd like to display page navigation. If null (the default), the current section will be used.
  • linkTextType: The type of text you want to use for the links. Options are 'title' (default) or 'order', which will display a number based on the page's order in the section.

Examples

Default Usage

On an exhibit theme's show.php template file, the default usage:

<?php
echo exhibit_builder_page_nav(); 
?>

This results in:

<ul class="exhibit-page-nav">
  <li><a href="/exhibits/exhibit-slug/section-slug/page-one/">Page One</a></li>
  <li><a href="/exhibits/exhibit-slug/section-slug/page-two/">Page Two</a></li>
  <li><a href="/exhibits/exhibit-slug/section-slug/page-three/">Page Three</a></li>
</ul>

Displaying Numbers for Link Text

We can simply add a value for the second argument, 'order', to use numbers for page links:

<?php
echo exhibit_builder_page_nav(null, 'order'); 
?>

This results in:

<ul class="exhibit-page-nav">
  <li><a href="/exhibits/exhibit-slug/section-slug/page-one/">1</a></li>
  <li><a href="/exhibits/exhibit-slug/section-slug/page-two/">2</a></li>
  <li><a href="/exhibits/exhibit-slug/section-slug/page-three/">3</a></li>
</ul>