Shortcode: Search

You are here:
Estimated reading time: 2 min

MinervaKB search can be placed virtually anywhere in your site using search shortcode. It has most of the parameters you can change in page builder or plugin settings, except for some global ones.

The simplest code to insert search would be

[mkb-search]

Here’s the result of the above shortcode.


Note, that defaults for shortcode are different from plugin settings and page builder settings. This is to allow easy shortcode insertion in any content, while search deafaults for home pages are more suitable for, well, home pages. 🙂
Here is a complete list of parameters:

Parameter Default Example values Description
title Empty “Looking for help?” A title above the search field
title_color #333 “#aa8855” or “rgb(125,230,180)” Search title color, you can use HEX or RGB values
title_size 1.2em “1.3em” or “20px” Search title font size, you can use em or pixels
theme clean “minerva” or “bold” Search theme. Currently available values are: minerva, clean, mini, bold, invisible, thick, 3d
border_color #fff “#aa8855” or “rgb(125,230,180)” Search input border color, used in some themes
min_width 38em “20em” or “200px” Minimum width for search input field. Maximium width is always 100% of parent container width
top_padding 2em “2em” or “30px” Top padding for search field
bottom_padding 1em “2em” or “30px” Bottom padding for search field
placeholder Empty “ex: Installation” Placeholder for input. When empty, global setting is used
tip_color #888 “#aa8855” or “rgb(125,230,180)” Search tip color. Use HEX or RGB values
add_pattern 0 1 or 0 Switch to add pattern overlay to search box
pattern Empty “http://your-domain.com/your-image.png” Pattern image URL. Works only when add_pattern is 1
topic_ids Empty “120,215,127” Limits search to some specific topics. Takes comma-separated topics IDs list
add_gradient 0 1 or 0 Switch to add gradient overlay to search box
gradient_from Empty “#00c1b6” Works only with add_gradient. When empty, global setting is used
gradient_to Empty “#00c1b6” Works only with add_gradient. When empty, global setting is used
gradient_opacity 1 “0.3” or “0.8” Works only with add_gradient. When empty, global setting is used
icons_left Empty 1 or 0 Put search icons on the left side. When empty, global setting is used
show_search_icon Empty 1 or 0 Show or hide search icon. When empty, global setting is used
search_icon Empty “fa-search” Search icon class. Use any Font Awesome class name, they’re prefixed with fa-. When empty, global setting is used
clear_icon 1 “fa-times-circle” Search clear icon class. Use any Font Awesome class name, they’re prefixed with fa-. When empty, global setting is used
tip Empty “Try searching for donuts” Search tip. When empty, global setting is used
no_focus 1 1 or 0 Disables search field autofocus. Note, enabling autofocus will scroll to search input on page load
bg rgba(255,255,255,0) “#00c1b6” Search container background. Transparent by default.
image_bg Empty “http://your-domain.com/your-image.png” Search container background image URL. Will be positioned using best fit to cover container
show_topic 1 1 or 0 A title above the search field
topic_label Empty “Topic” Topic label to use in search results
topic_bg Empty “#00c1b6” Topic label background color. When empty, global settings are used.
topic_color Empty “#fff” Topic label text color. When empty, global settings are used.

To insert search anywhere in your theme, use the do_shortcode() function. For example, see the following code:
<?php echo do_shortcode( '[mkb-search title="Need help?" bg="#fff" /]' ); ?>

Was this article helpful?
Dislike 4 29 of 33 found this article helpful.
Views: 2197
Previous: Shortcodes
Next: Shortcode: Tip
Have questions? Search our knowledgebase.
Send this to a friend