Using the Shortcodes

With the BasePress plugin you don’t use shortcodes to build your knowledge base. You can read how to create your knowledge base in the getting started section of our documentation.
BasePress uses shortcodes to to create a dynamic list of articles from your knowledge base, which can appear in any post or page of your website. Another useful function of the shortcode is to create a search bar anywhere in your website to run searches from your knowledge base.

Adding a list of KB articles in your website

BasePress has a shortcode generator to easily creates a list of articles from your knowledge base, to be displayed in posts or pages in your website. Suppose you want the 5 most viewed articles from your knowledge base to appear on your homepage then you would use the shortcode generator to create this list.

To access the knowledge base shortcode editor navigate to BasePress >Shortcode Editor.

Knowledge Base Shortcode Editor
Knowledge Base Shortcode Editor.

The shortcode editor allows you to choose articles from a certain Knowledge Base (Product) if you have multiple KBs or specific sections in your KB. You can then choose how you would like to order these articles and the amount of articles in the list. So firstly, you select all the options you need like the knowledge base, sections, then the order and so on. A preview of the articles appear in the text area on the right. Please remember: The results you see while testing the shortcode are dynamic and will change over time. It depends on article views, article scores or if you add new articles to your documentation.

Once you are happy with the results you can copy the shortcode and paste it in the posts or pages where you want the list of articles to appear in your website.
The style of the generated list of articles, will correspond to your WordPress theme.

Adding a knowledge base search bar in your website

You can add a search bar to any page or post of your website if you need to retrieve information from your KB. You can use the dedicated Gutenberg block or this shortcode: [ basepress-search kb=”knowledgebase-slug” with=”600px”].
Place the shortcode where you want the search bar to appear.

Remember: Unless you specify the “knowledge-base-slug” the search will run in all your KBs. If you omit the width, the search bar will stretch 100% of the available space.

Read more on the BasePress Search Bar Features.

Was this helpful?

Previous Article

Using Widgets