{"id":85140,"date":"2018-08-30T03:54:38","date_gmt":"2018-08-30T07:54:38","guid":{"rendered":"https:\/\/www.templatemonster.com\/help\/?p=85140"},"modified":"2022-01-18T10:21:17","modified_gmt":"2022-01-18T15:21:17","slug":"how-to-create-a-wiki-knowledge-base-using-wordpress","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/how-to-create-a-wiki-knowledge-base-using-wordpress.html","title":{"rendered":"How to Create a Wiki Knowledge Base Using WordPress"},"content":{"rendered":"<p>Are you looking to add knowledgebase to your website? We are ready to show you how to build a Wiki site with WordPress. There are three known ways to do that.<\/p>\r\n<h3 class=\"custom\">Using Wiki theme<\/h3>\r\n<p>The easiest way to use Wiki on your site is to use WordPress knowledge base theme.<\/p>\r\n<p> Please, note that is has to be installed to some subdirectory on your server. The main disadvantage of this method is that you cannot use it in case you have working site already.<\/p>\r\n<p>Many websites have their knowledgebases on subdomains. That is normal practice.<\/p>\r\n<h3 class=\"custom\">Adding Wiki knowledgebase using plugin<\/h3>\r\n<p>If your theme doesn&#8217;t contain Wiki knowledgebase by default you can easily insert it using a WordPress wiki knowledgebase plugin. You can find several plugins available on <a href=\"https:\/\/wordpress.org\/plugins\/tags\/wiki\/\" target=\"_blank\" rel=\"nofollow noopener\">WordPress official website<\/a>. We recommend using <a href=\"https:\/\/wordpress.org\/plugins\/wp-knowledgebase\/\" target=\"_blank\" rel=\"nofollow noopener\">Knowledge Base by PressApps<\/a> one.<\/p>\r\n<p>All that is required is plugin installation. Do that as usually under the <strong>Plugins<\/strong> > <strong>Installed Plugins<\/strong> > <strong>Add New<\/strong> section in your admin panel.<\/p>\r\n<p>Once it&#8217;s installed your have <strong>Knowledge<\/strong> page in your WordPress backend. This area is a set of custom posts that allows you to organize your own knowledgebase.<\/p>\r\n\r\n<h3 class=\"custom\">Code Snippet Method of inserting Wiki knowledgebase on WordPress website<\/h3>\r\n<p>Another way to add Wiki knowledgebase to website is to create dedicated website using the code method.<\/p>\r\n<p>This method is more flexible. But remember it requires some code knowledge. Here are step by step instructions:<\/p>\r\n<ol>\r\n\t<li>\r\n\t\t<p>Navigate to <strong>Plugins<\/strong> > <strong>Add New<\/strong> page in your WordPress backend. Enter <em>Knowledge Base CPT<\/em> to the search field. Activate theme after upload.<\/p>\r\n\t<\/li>\r\n\t<li>\r\n\t\t<p>After plugin activation you will have custom post type called <em>knowlage_base<\/em> and it is called a <em>taxomony<\/em> in your admin panel.<\/p>\r\n\t<\/li>\r\n\t<li>\r\n\t\t<p>You can easily add and organize articles in your admin panel under the <strong>Knowledge Base<\/strong> tab.<\/p>\r\n\t\t<\/li>\r\n\t<li>\r\n\t\t<p>\r\n\t\t\tOnce you have several articles ready you will need to organize your knowledgebase page.\r\n\t\t<\/p>\r\n\t<\/li>\r\n\t<li>\r\n\t\t<p>To start doing that insert following snippet code in to the <strong>functions.php<\/strong> file:<\/p>\r\n\t\t<pre class=\"brush:php\">function my_knowledgebase() {\r\n\t\t\t\/\/ Get Knowledge Base Sections\r\n\t\t\t$kb_sections = get_terms('section','orderby=name&hide_empty=0');\r\n\t\t\t\/\/ For each knowledge base section\r\n\t\t\tforeach ($kb_sections as $section) :\r\n\t\t\t$return .= '&lt;div class=&quot;kb_section&quot;&gt;';\r\n\t\t\t\/\/ Display Section Name\r\n\t\t\t$return .= '&lt;h4 class=&quot;kb-section-name&quot;&gt;&lt;a href=&quot;&#39;. get_term_link( $section ) .&#39;&quot; title=&quot;&#39;. $section-&gt;name .&#39;&quot; &gt;&#39;. $section-&gt;name .&#39;&lt;\/a&gt;&lt;\/h4&gt;&lt;ul class=&quot;kb-articles-list&quot;&gt;';\r\n\t\t\t\r\n\t\t\t\/\/ Fetch posts in the section\r\n\t\t\t$kb_args = array(\r\n\t\t\t'post_type' => 'knowledge_base',\r\n\t\t\t'posts_per_page'=>-1,\r\n\t\t\t'tax_query' => array(\r\n            array(\r\n\t\t\t'taxonomy' => 'section',\r\n\t\t\t'terms'    => $section,\r\n            )       ,\r\n\t\t\t),\r\n\t\t\t);\r\n\t\t\t\r\n\t\t\t$the_query = new WP_Query( $kb_args );\r\n\t\t\tif ( $the_query->have_posts() ) : \r\n            while ( $the_query->have_posts() ) : $the_query->the_post(); \r\n\t\t\t$return .=  '&lt;li class=&quot;kb-article-name&quot;&gt;';\r\n\t\t$return .=  '&lt;a href=&quot;&#39;. get_permalink( $the_post-&gt;ID ) .&#39;&quot; rel=&quot;bookmark&quot; title=&quot;&#39;. get_the_title( $the_post-&gt;ID ) .&#39;&quot;&gt;'. get_the_title( $the_post->ID ) .'<\/a>';\r\n\t\t$return .=  '&lt;\/li&gt;';\r\n\t\tendwhile; \r\n\t\twp_reset_postdata(); \r\n\t\telse : \r\n\t\t$return .= '&lt;p&gt;No Articles Found&lt;\/p&gt;';\r\n        endif; \r\n\t\t$return .=  '&lt;\/ul&gt;&lt;\/div&gt;';\r\n\t\tendforeach;\r\n\t\treturn $return;\r\n\t\t}\r\n\t\t\/\/ Create shortcode \r\n\t\tadd_shortcode('knowledgebase', 'my_knowledgebase');<\/pre>\r\n\t<p>This code lists all the articles under the section they are added into.<\/p>\r\n<\/li>\r\n<li>\r\n\t<p>Next step is page creation. That is usual procedure. Do that under <strong>Pages<\/strong> > <strong>Add New<\/strong> page in your backend.<\/p>\r\n<\/li>\r\n<li>\r\n\t<p>Use the following shortcode to insert your knowledgebase posts to page <strong>[knowledgebase]<\/strong><\/p>\r\n<\/li>\r\n<li>\r\n\t<p>Save the page and check your site.<\/p>\r\n<\/li>\r\n<li>\r\n\t<p>You will see that page has no style. It can be easily managed in CSS code. Paste following rule to <strong>Additional CSS<\/strong> field under <strong>Appearance<\/strong> > <strong>Customizer<\/strong> page in your backend:<\/p>\r\n\t<pre class=\"brush:css\">.kb_section {\r\n\tfloat: left;\r\n\twidth: 280px;\r\n\tmax-width: 280px;\r\n\tmargin: 10px;\r\n\tbackground-color: #f5f5f5;\r\n\tborder: 1px solid #eee;\r\n}\r\nh4.kb-section-name {\r\n\tbackground-color: #eee;\r\n\tmargin: 0;\r\n\tpadding: 5px;\r\n}\r\nul.kb-section-list {\r\n\tlist-style-type: none;\r\n\tlist-style: none;\r\n\tdisplay: inline;\r\n}   \r\nli.kb-section-name {\r\n\tlist-style-type: none;\r\n\tdisplay: inline;\r\n}\r\nul.kb-article-list {\r\n\tlist-style-type: none;\r\n\tlist-style: none;\r\n}   \r\nli.kb-article-name {\r\n\tlist-style-type: none;\r\n}\r\ndiv.kb_section:nth-of-type(3n+1) {clear:left;}<\/pre>\r\n\t<p>Please, note! CSS code may differ for the theme you use. Each theme has specific CSS classes.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<p>We hope this article was helpful. If more help is required you can check our tutorials.<\/p>\r\n<p>If you&#8217;re looking for a professional template to build a website, view <a href=\"https:\/\/www.templatemonster.com\/wordpress-themes.php\" title=\"Premium WordPress Templates\" target=\"_blank\" rel=\"noopener\">WordPress Themes<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Are you looking to add knowledgebase to your website? We are ready to show you how to build a Wiki site with WordPress. There are three known ways to do that.<\/p>\n","protected":false},"author":55,"featured_media":85143,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2017,728],"tags":[2683,2682],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/85140"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=85140"}],"version-history":[{"count":5,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/85140\/revisions"}],"predecessor-version":[{"id":86614,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/85140\/revisions\/86614"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/85143"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=85140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=85140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=85140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}