The navbar field
Keep a search field in your own header. Shoppers type in it as usual, example searches type themselves into it, and Cmd K or Ctrl K gets them there fast.
Mark the field#
Add data-pxl-search to the search field in your header. You can put it on the <input>, or on the form or wrapper around it.
<form role="search" class="site-search"> <input type="search" data-pxl-search placeholder="Search or ask anything" aria-label="Search"> <kbd>⌘K</kbd> </form>
Shoppers type in it and press Enter to open the answers. Clicking the icon or the padding around the field puts the cursor in it.
The <kbd> is your own hint text. It is optional and only a label: the plugin listens for the keys either way.
Examples type themselves#
Until a shopper types, example searches type themselves into the field's placeholder, at the Typing speed you set under Look and feel. A field the shopper types in keeps their text.
- Up to 3 marked fields per page type examples.
- The typing stops once the shopper has searched, while answer tabs are open.
- The examples are your example searches, or, when you wrote none, suggestions PXL Search writes from your store.
A field that a script adds after the page has loaded does not type examples. It still opens the answers on Enter.
Cmd K and Ctrl K#
⌘ K (Ctrl K on Windows) opens the search on any page where it is placed: one of PXL Search's own bars (shortcode, block, widget), an element or field marked data-pxl-search, or Take over my theme's search turned on. It works from the first page load.
- If your theme already uses that key for its own search box, PXL Search leaves it alone: the key focuses that box, and Enter opens PXL Search.
- Pressed again while the search is open, it puts the cursor back in the search box. Esc closes the search, and the key opens it again.
- With Shift or Alt held, the key is ignored.
- On a page with no PXL Search placement, it does nothing, and the browser keeps its own shortcut.
Back to Place the search in your theme.