Search

Knowledgebase Docs » ShiftNav » Advanced Content
Knowledgebase Docs » ShiftNav » Shortcodes
USEFUL? 7

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.