Last Modified: KB » WooCommerce KB Articles Pro
WordPress Theme Integration

The KB Articles plugin integrates with any theme for WordPress automatically, because it integrates with a WordPress core feature, Custom Post Types. Whenever you install the KB Articles plugin it adds a new Post Type that is specifically for KB Articles.

The KB Articles plugin also adds support for what is referred to as a Post Type Archive, which is what allows WordPress themes to display an archive view of all KB Articles; including, but not limited to: KB Articles by Category, Tag, Author, and/or KB Articles associated with a specific WooCommerce Product.

See also: KB Article Post Type for further details.

Storefront Theme Integration

Because the free Storefront theme for WooCommerce is so popular, we've done a special integration with Storefront that enhances the display of KB Articles when you've selected Storefront as your WooCommerce theme.

These enhancements consist of two Storefront-optimized template files that are automatically used in favor of the slightly generic/multipurpose Storefront defaults. The effect is that whenever it is a single KB Article that is being displayed, or when a KB Article archive view is being displayed, the KB Article template overrides kick-in automatically and enhance the presentation of your Articles; i.e., styling them as 'Articles' instead of as blog posts.

So if you're on-the-fence about which WordPress theme to use, and you're planning to use the KB Articles plugin, we suggest going with the Storefront theme. It's the default theme for WooCommerce and it's quite extensible and easy to customize. The best part? KB Articles look amazing in this theme!

Tip: Widgets provided by the KB Articles plugin have also been optimized for the Storefront theme.

Example Archive View in Storefront Theme

Archive View in Storefront Theme

Using Any Other WordPress Theme

As noted previously, the KB Articles plugin works beautifully with any theme for WordPress. However, if you're using a theme other than the Storefront theme, you'll want to read the next section about Custom KB Article Template Files. While not absolutely necessary, over time you might want to enhance the display of KB Articles in your theme. This is done by adding two additional WordPress template files and tuning them in.

Custom KB Article Template Files

Whether you're using the Storefront theme or another theme, you can always override the default KB Article templates by creating these two files inside your active WordPress theme directory. These give you full control over the display of any single KB Article and also archive views; i.e., lists of KB Articles that are filtered in one way or another.

1. single-kb_article.php

.../wp-content/themes/[ACTIVE THEME]/single-kb_article.php

This template file controls the display of individual KB Articles. When you visit a KB Article Permalink, this is what WordPress will use. If your WordPress theme already has a file with the less-specific name single.php, we suggest making a copy of that file and then customizing it further for the display of a KB Article.

e.g., single.php make a copy → single-kb_article.php and customize.

2. archive-kb_article.php

.../wp-content/themes/[ACTIVE THEME]/archive-kb_article.php

This template file controls the display of KB indexes (i.e., archive views). When browsing the knowledge base overall, which lists all KB Articles, or when you visit a Product-specific knowledge base, this is what WordPress will use. If your WordPress theme already has a file with the less-specific name archive.php, we suggest making a copy of that file and then customizing it further for the display of a KB Article archive.

e.g., archive.php make a copy → archive-kb_article.php and customize.

See Also: WordPress Template Hierarchy

If you get stuck, it may help to review this article at WordPress.org. See: WordPress Template Hierarchy. For example, if your WordPress theme doesn't provide you with starter files: single.php or archive.php to work from, there may be other files in the hierarchy that you could take advantage of. Reviewing the template hierarchy is a good idea anyway, as it gives you some great insight. You'll learn more about how WordPress works.

Diagram (Click to Enlarge)

WordPress Template Hierarchy