Toggles

Knowledgebase Docs » ShiftNav » Toggles

Toggles 12

ShiftNav Toggles can be inserted anywhere via PHP, HTML, or Shortcode. To add a toggle, you just need to define its target (the ShiftNav instance ID), and give it some content. The ID for the main ShiftNav instance is shiftnav-main. When you create additional instances in ShiftNav Pro, you create their IDs and they are displayed in the tabs in your settings panel. Instance Toggles [Pro] With ShiftNav Pro, when you add a new instance, ShiftNav will automatically generate and display the code you can use to insert toggles for that ShiftNav instance.

View

Toggles: HTML 9

Creating a toggle in HTML has two basic requirements: 1. It must have the class shiftnav-toggle 2. It must have a data-shiftnav-target attribute set to the ID of the menu that should be toggled upon activation Here’s an example of a toggle for the main ShiftNav This will create a link with the text “Toggle Content” that, when clicked, will toggle the Main ShiftNav open and closed. By default, ShiftNav won’t add any styling to this link, but you can use classes from your theme (button or btn are common) to style the toggle as a button or however you like.

View

Toggles: PHP 0

PHP toggle tags are perfect for adding toggles in your theme templates. To insert a toggle for the main ShiftNav panel, you would use this You can set the content of the toggle with the second parameter. 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: would produce this markup:

View

Toggles: Shortcode 0

ShiftNav provides a shiftnav_toggle shortcode which can be used to print a toggle anywhere in your content. The target attribute is the ID of the instance which should be opened. If you want to set custom content, you can enter that in the shortcode content area

View