Toggles: PHP

Knowledgebase Docs » ShiftNav » API
Knowledgebase Docs » ShiftNav » Toggles

PHP toggle tags are perfect for adding toggles in your theme templates.

function shiftnav_toggle( $target_id , $content = null, $args = array() )

To insert a toggle for the main ShiftNav panel, you would use this

<?php shiftnav_toggle( 'shiftnav-main' ); ?>

You can set the content of the toggle with the second parameter.

<?php shiftnav_toggle( 'shiftnav-main' , 'Open Sesame!' ); ?>

The third parameter takes an array of arguments which can be used to define an ID, element/tag, and additional classes to add to the toggle. For example, the following:

shiftnav_toggle( 'shiftnav-main' , 'Open Sesame!' , array( 
     'id' => 'my-special-toggle',
     'el' => 'span',
     'class' => 'button' 
) ); ?>

would produce this markup:

<span id="my-special-toggle" class="shiftnav-toggle button" data-shiftnav-target="shiftnav-main">Open Sesame!</span>