Use this shortcode to add a search bar to a page, post, widget, or View. This search bar will only search content within a View or entry list. Please note that this search bar will not search categories, taxonomies, or custom fields.
Use the shortcode builder
- Go to a WordPress page or post.
- Click on the 'Formidable' button above the content box.
- Click on the 'Search' option and then select from the options below.
- Click the ‘Insert into Post’ button.
Insert the shortcode manually
Insert the following shortcode in the before content of a View or in a page/post that contains a View. This search form can also be used to search an entry list.
[frm-search]
If you would like to use this search form in a widget or on a different page from your View, use the following shortcode:
[frm-search post_id=x]
Replace 'x' with the ID of the page that contains your View.
Parameters
Optional
- post_id - ID of the page or post where the View or entry list is published. Use this option if you would like the search bar on a different page from your View or entry list. Usage:
[frm-search post_id=x]
- label - Change the default label on the search button. Usage:
[frm-search label="Search"]
- views - Only search specific Views on the page. This is helpful if you have multiple Views on a page and you would like to search only some of those Views. Usage:
[frm-search views="x,y,z"]
Replace x, y, and z with View IDs.
Add Styling
Formidable Styling
If you would like to use Formidable styling for the Search button, insert this on your page:
<div class="with_frm_style"><div class="frm_submit">[frm-search]</div></div>
Also, make sure you have selected the option to Load Formidable Styling on every page of your site in your Formidable Global Settings.
Custom Styling
If you would like to change the styling of your search bar, you can add a couple of classes to your theme style.css or your Custom CSS on the Formidable → Global Settings → Custom CSS page. You could add something like this:
#frm_search {width:60%;} .searchsubmit {width:20%;}
Making changes to #frm_search affects the input field and .searchsubmit affects the search button.
Browser Styling
Chrome and Safari will add their own styling to the search bar. If you want to "turn off" that styling and use your theme styling instead, add this CSS:
input[type=search] { -webkit-appearance:textfield; -webkit-box-sizing:content-box; } input::-webkit-search-decoration, input::-webkit-search-cancel-button { display: none; }
PHP Alternative
FrmProEntriesController::get_search(array('post_id' => x));
Replace 'x' with the ID of the page that contains your View.
Related Hooks
- Search for an entire string in the search bar with the frm_search_any_terms hook.