Override plugins internal rendering templates

GD Knowledge Base Pro uses own templates system to render almost everything you can see in the knowledge base pages and allowing you to replace these templates to change how the plugin pages look like.

All default templates are located in the plugin folder under templates/default. Inside that folder, you have folders with JavaScript and CSS used for the rendering, three more folders, all with plugins templates (kb, search, widget), the folder with special compatibility templates and folder with templates for theme compatibility mode.

All templates used by the search results page are in the templates/default/search folder. All templates used by widgets are in templates/default/widgets folder. The rest of the templates are in templates/default/kb folder.

To load templates, the plugin uses own gdkob_load_template() function. By following this function you can see how the templates and where load other templates.

Templates override

All templates can be overridden in two ways: custom templates storage or theme.

Theme or Child Theme

In theme (or child theme) you need to place templates inside the folder called ‘kb‘, so if your theme is called ‘my-theme’, Knowledge Base templates should go into wp-content/themes/my-theme/kb. It is recommended to use a child theme, especially if your theme is updated often because if the theme is updated, all the theme changes will be removed.

Custom Storage

Custom storage takes priority over default templates in the plugin, and theme (or child theme) take priority over all storages (plugin tries to load a template from child theme and theme first, custom storages and default storages last). You can add new storage anywhere in the wp-content folder, and you can register it using a function:

Custom styling override

You can override all templates, CSS and JS can’t be replaced, but, if you need custom styling, you can add special CSS stylesheet files into the theme and/or child theme. Make sure to create a CSS file named style-gdkob.css and place it into your theme folder. This file would be loaded after the main plugin CSS file. If you have theme and child theme, both can have own style-gdkob.css files, and the plugin will load both of them, the theme first, child theme second.

Rate this article

You are not allowed to rate this post.

Leave a Comment