Shortcodes

Knowledgebase Docs » ShiftNav » Shortcodes

Shortcodes [Pro] 0

ShiftNav Pro includes several shortcodes for adding custom content to your menu. They can be placed in the Custom Content areas above and below the menu in the ShiftNav Control Panel.

View

Search [Pro] 9

ShiftNav provides a search bar shortcode which you can insert into the Custom Content areas before or after the menu in your ShiftNav menu settings. [shiftnav-search] You can also set the placeholder text with the placeholder attribute [shiftnav-search placeholder=”Enter to search”] By default it is set to “Search…” Search shortcode in the menu panel Searching for a specific post type since v1.5 The search bar is simply a form that submits your search string to the WordPress core search system. The search results are gathered by WordPress, and displayed by your theme. So this shortcode is responsible only for the search form itself, not the results or their display. If you would like to limit the type of posts that will be searched, however, you can do so by setting the post_type attribute in the shortcode. For example, if you only want to search for a custom post type “product”, you could use the shortcode [shiftnav-search post_type=”product”] This restriction will be submitted with the form, and WordPress will then only return posts that are products.

View

Toggles: Shortcode 3

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. To set an icon (such as the hamburger bars), set the icon attribute If you want to set custom content, you can enter that in the shortcode content area Hint: Mobile visibility By default this toggle will appear at all viewport widths. Want it to appear only below the same breakpoint as the main toggle bar? Add the shiftnav-toggle-mobile class to the toggle bar element Note that this visibility can be easily overridden by other CSS on your site, so if it is not working, check that you don’t have other CSS setting this to display:none; [shiftnav_toggle] Generates a toggle for the specified panel. target Specifies the panel that this toggle controls by ID icon The name of the Font Awesome icon to display. Use bars for the hamburger icon. toggle_id Apply an id attribute to the toggle element class Apply a CSS class to the toggle element el Change the element tag for the toggle. Anchor (a) by default. aria_label Set an aria-label attribute on the toggle {content} Any content placed between opening and closing shortcode tags will be the content of the toggle

View

Toggle Bar Search [Pro] 10

Since version 1.1 To add a drop-down search box to your main toggle bar, add this shortcode to the Toggle Content Right Edge or Toggle Content Left Edge box under the ShiftNav Settings > Toggle Bar Shortcode Setting Result Searching for a specific post type since v1.5 The search bar is simply a form that submits your search string to the WordPress core search system. The search results are gathered by WordPress, and displayed by your theme. So this shortcode is responsible only for the search form itself, not the results or their display. If you would like to limit the type of posts that will be searched, however, you can do so by setting the post_type attribute in the shortcode. For example, if you only want to search for a custom post type “product”, you could use the shortcode [shiftnav-search-toggle post_type=”product”] This restriction will be submitted with the form, and WordPress will then only return posts that are products.

View