WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» How to Create a Wiki Knowledge Base Using WordPress

How to Create a Wiki Knowledge Base Using WordPress

Last updated on July 30th, 2016 by Editorial Staff
461 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Create a Wiki Knowledge Base Using WordPress

Are you looking to add a support / documentation section to your site? Want to know the best way to add a wiki knowledge base to your WordPress site? In this article, we will show you how to create a wiki knowledge base in WordPress.

Business Learning and Support

There are three different ways you can build a wiki site within WordPress:

  • You can use a dedicated WordPress wiki theme to build your knowledge base.
  • You can use a dedicated WordPress wiki plugin to build your knowledge base.
  • You can use some custom code snippets to build your knowledge base.

Now there are pros and cons to each method. But don’t worry, we will explain each of them, so you can make the right choice.

Video Tutorial

Subscribe to WPBeginner

If you don’t like the video or need more instructions, then continue reading.

WordPress Wiki & Knowledge Base Theme Method

KnowHow - WordPress Knowledge Base Theme

One of the easiest way to build a wiki is to use a WordPress wiki knowledge base theme. There are tons of them available, but we recommend KnowHow Theme.

The best way to setup is to install WordPress on a subdomain or directory like support.yoursite.com or yoursite.com/knowledgebase/

Once done, you just need to install and activate the KnowHow theme and it will work out of the box.

KnowHow Preview

The biggest downside of using any WordPress Wiki & Knowledge Base theme is that you cannot use them on your main site. You have to do the setup on a subdomain or directory because these themes do not really match your branding, and you definitely do not want your homepage to be a wiki.

However many sites have their knowledge base on a subdomain, so this is not as bad as it sounds. The decision really comes down to your preference.

WordPress Wiki & Knowledge Base Plugin Method

Knowledge Base Plugin

If you want to add a wiki knowledge base to your existing WordPress site, then the easiest way to do it is by using a WordPress wiki knowledge base plugin. There are several plugins available, but we recommend Knowledge Base by PressApps (Live Demo available).

All you have to do is install and activate the plugin. Once activated, it adds a Knowledge Base tab in your WordPress admin area.

Knowledge Base Admin

Knowledge Base is it’s own custom post type with categories and tags which allows you to organize your documentation.

The best part about this is that you can add it on your main site, and it will match your brand style / formatting for the most part. It also comes with public / member only voting system, custom widgets, drag-drop functionality, etc. The downside is that it costs $20.

In our next method, we will show you how you can accomplish all of this for free, but it does involve code.

WordPress Wiki & Knowledge Base Code Snippet Method

Another way to add a wiki knowledge base to your existing WordPress site or even create a dedicated wiki site is to use the code snippet method.

The downside is that you have to copy/paste a little bit of code which can be scary for beginners. The upside is that it gives you more freedom, and it’s completely free unlike the first two options.

We will do our best to give step by step instructions.

Note: Before you start, please create a complete backup of your WordPress site.

First thing you need to do is install and activate the Knowledgebase CPT plugin. This simple plugin creates a custom post type called knowledge_base and a taxonomy called section.

This allows you to easily add your wiki articles and organize them into sections.

Adding knowledge base articles and sections

Once you have a few articles and sections, you would need to display them on your website. This is where you need to deal with a little bit of code.

Start by adding this code snippet into your theme’s functions.php file or a site-specific plugin.

function wpb_knowledgebase() {
	// Get Knowledge Base Sections
	$kb_sections = get_terms('section','orderby=name&hide_empty=0');
	// For each knowledge base section
	foreach ($kb_sections as $section) :
	$return .= '<div class="kb_section">';
	// Display Section Name
	$return .= '<h4 class="kb-section-name"><a href="'. get_term_link( $section ) .'" title="'. $section->name .'" >'. $section->name .'</a></h4><ul class="kb-articles-list">';
	
	// Fetch posts in the section
	$kb_args = array(
		'post_type' => 'knowledge_base',
		'posts_per_page'=>-1,
		'tax_query' => array(
			array(
				'taxonomy' => 'section',
				'terms'    => $section,
			)		,
		),
	);
	
	$the_query = new WP_Query( $kb_args );
		if ( $the_query->have_posts() ) : 
			while ( $the_query->have_posts() ) : $the_query->the_post(); 
				$return .=  '<li class="kb-article-name">';
				$return .=  '<a href="'. get_permalink( $the_post->ID ) .'" rel="bookmark" title="'. get_the_title( $the_post->ID ) .'">'. get_the_title( $the_post->ID ) .'</a>';
				$return .=  '</li>';
	 		endwhile; 
	wp_reset_postdata(); 
		 else : 
	 			$return .= '<p>No Articles Found</p>';
	 	endif; 
	$return .=  '</ul></div>';
	endforeach;
	return $return;
}
// Create shortcode 
add_shortcode('knowledgebase', 'wpb_knowledgebase');

This code lists all the knowledge base articles under the section they were filed in.

Next all you need to do is create a new WordPress page and add [knowledgebase] shortcode inside it. Save your page and preview it.

Plain knowledge base section with no CSS

It looks very plain right now, but we can add some styling to it. You can use this CSS as starting point and then continue editing to match your own colors.

Paste the following code in your theme’s style.css file.

.kb_section {
float: left;
width: 280px;
max-width: 280px;
margin: 10px;
background-color: #f5f5f5;
border: 1px solid #eee;
}
h4.kb-section-name {
background-color: #eee;
margin: 0;
padding: 5px;
}
ul.kb-section-list {
list-style-type: none;
list-style: none;
display: inline;
}	
li.kb-section-name {
list-style-type: none;
display: inline;
}
ul.kb-article-list {
list-style-type: none;
list-style: none;
}	
li.kb-article-name {
list-style-type: none;
}
div.kb_section:nth-of-type(3n+1) {clear:left;}
div.kb_section:nth-of-type(3n+3) {}

This how it looked on our demo site where we are using Twenty Twelve theme.

Styled knowledge base page in WordPress

By default, your sections will be displayed in alphabetical order. However if you want to change the order of sections, then you can do that by installing Custom Taxonomy Order NE plugin. This will allow you to drag-drop your sections in the right order.

That’s all, we hope this article helped you add a Wiki knowledge base section on your WordPress site. You may also want to check out our tutorial on how to add a FAQs section in WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Google+.

461 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

14 Comments

Leave a Reply
  1. Raphaël says:
    Sep 12, 2018 at 7:28 am

    Hello,

    first thanks for this wonderful tutorial! Very clear and detailed, and it exactly fulfills what I was looking for!

    I just have an easy question (last method).
    I don’t know anything about CSS, and when I add the bit of code to the style.css file, upload the file, and check how my Wiki looks, it’s still plain.
    Did I miss something?

    Thanks very much for your help! :-)
    Raphaël

    Reply
  2. yoshi says:
    Feb 17, 2018 at 10:23 am

    Hi,

    I think there is a problem with the last function wpb_knowledgebase(),
    >>>> WP: 4.9.4

    I made 10 articles and 3 sections.

    The function display articles from the first section, in the second section too.
    The function display articles from the second section, in the third section too.
    But the function articles from the third section without trouble.

    Reply
  3. Clm says:
    Feb 3, 2017 at 7:31 pm

    Merci ! Super cool

    Reply
  4. Michal says:
    Apr 29, 2016 at 9:04 am

    Hello! thanks for help. I picked the last option, to make KB myself. I wonder how to make it works like this:

    example.com/knowledgebase/ – list of sections and articles
    example.com/knowledgebase/section/ -list of articles in a section
    example.com/knowledgebase/section/article – article

    at the moment the url’s looks a bit messy :/
    How should I do it?
    thanks!

    Reply
    • WPBeginner Support says:
      May 1, 2016 at 6:09 pm

      Please contact plugin author for support.

      Reply
  5. Jenifer T. says:
    Feb 29, 2016 at 8:27 pm

    I vote for using DW Knowledge Base plugin. It does not require you must have a specific theme to create a Knowledge Base plugin. And it’s totally free at this moment.

    Reply
  6. Kay Slater says:
    Nov 27, 2015 at 2:25 pm

    Thank you. I was able to use it for a community dtes gallery website that has limited resources. I really appreciate your sharing this.

    Reply
  7. Bob G says:
    Sep 23, 2015 at 9:44 am

    I want to add a knowledgebase to an existing site, using existing posts. None of the plugins that I have tried have this capability, however. Do you know of a plugin that will incorporate existing posts?

    Reply
  8. BobH says:
    Mar 20, 2015 at 3:06 pm

    Note that the functions.php file that you have to edit is the one in your theme’s subdirectory in wp-content NOT the one in wp-includes.

    Reply
  9. Bob H says:
    Mar 20, 2015 at 11:33 am

    I chose option 3 and edited functions.php and added the code above and got this error

    Call to undefined function add_shortcode()

    Any ideas why?

    Reply
    • BobH says:
      Mar 20, 2015 at 3:37 pm

      The reason I got the error is because I was editing the WRONG functions.php file:

      The functions.php file that you have to edit is the one in your theme’s subdirectory in wp-content NOT the one in wp-includes.

      Reply
  10. Bob H says:
    Mar 20, 2015 at 11:18 am

    I’ve been looking for something like this for a while. BUT, note that there is a big difference between a knowledgebase, that is administered and populated by the owner/author and a wiki, which by definition “allows collaborative modification, extension, or deletion of its content and structure”

    So, we know now how to do a knowlegebase, but how do we do a wiki?

    Reply
    • tamimth says:
      Mar 29, 2015 at 5:23 am

      I’m looking for the same thing and all I got is how to do a knowledgebase. if you find anything related to how to do wiki please share.

      Reply
  11. Ajay says:
    Mar 18, 2015 at 9:35 am

    Syed,

    Thanks for the options. I’ve been debating how to best go about adding a knowledge base for my plugins.
    In case of a subdomain approach, it would mean having a separate WordPress site for the knowledge base which is good, but at the same time it means having the user to register twice.

    In case of the plugin approach, I’m not sure how much of a load it will add to the existing site.

    Any ideas?

    Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
RafflePress - WordPress Giveaway and Contest Plugin
RafflePress
Giveaway and Contest Plugin for WordPress. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
HostGator
HostGator Coupon
Get 62% OFF HostGator, one of the most reliable and popular web hosting companies! Includes FREE domain.
SeedProd Logo
SeedProd Coupon
Get 50% OFF SeedProd Coming Soon Page plugin for WordPress.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.