wordpress创建_如何使⽤WordPress创建Wiki知识库
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.
您是否要在⽹站上添加⽀持/⽂档部分? 是否想知道将Wiki知识库添加到WordPress⽹站的最佳⽅法? 在本⽂中,我们将向您展⽰如何在WordPress中创建Wiki知识库。
There are three different ways you can build a wiki site within WordPress:
您可以通过三种不同的⽅法在WordPress中构建Wiki⽹站:
You can use a dedicated WordPress wiki theme to build your knowledge base.
您可以使⽤专⽤的WordPress Wiki主题来建⽴您的知识库。
You can use a dedicated WordPress wiki plugin to build your knowledge base.
您可以使⽤专⽤的WordPress Wiki插件来建⽴您的知识库。
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)wordpress主题怎么安装
If you don’t like the video or need more instructions, then continue reading.
如果您不喜欢该视频或需要更多说明,请继续阅读。
WordPress Wiki和知识库主题⽅法 (WordPress Wiki & Knowledge Base Theme Method)
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 .
构建Wiki的最简单⽅法之⼀就是使⽤WordPress Wiki知识库主题。 有很多可⽤的,但是我们建议使⽤ 。
The best way to setup is to on a subdomain or directory ursite or yoursite/knowledgebase/
最好的设置⽅法是在诸如ursite或yoursite/knowledgebase/的⼦域或⽬录上 。
Once done, you just need to install and activate the KnowHow theme and it will work out of the box.
完成后,您只需要安装并激活KnowHow主题即可使⽤。
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.
使⽤任何WordPress Wiki和知识库主题的最⼤弊端是您不能在主站点上使⽤它们。 您必须在⼦域或⽬录上进⾏设置,因为这些主题与您的品牌并不完全匹配,并且您绝对不希望您的主页成为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和知识库插件⽅法 (WordPress Wiki & Knowledge Base Plugin Method)
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 (Live Demo available).
如果您想将Wiki知识库添加到现有的WordPress⽹站,那么最简单的⽅法是使⽤WordPress Wiki知识库插件。 有⼏个可⽤的插件,但我们建议您 (提供实时演⽰)。
All you have to do is install and activate the plugin. Once activated, it adds a Knowledge Base tab in your WordPress admin area.
您所要做的就是安装并激活插件。 激活后,它将在WordPress管理区域中添加“知识库”选项卡。
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.
最好的部分是您可以将其添加到您的主站点上,并且⼤多数情况下将与您的品牌风格/格式相匹配。 它还带有公共/会员专⽤投票系统,⾃定义⼩部件,拖放功能等。缺点是它的价格为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和知识库代码段⽅法 (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.
将Wiki知识库添加到现有WordPress⽹站甚⾄创建专⽤Wiki站点的另⼀种⽅法是使⽤代码段⽅法。
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 .
注意:在开始之前,请创建的完整 。
First thing you need to do is install and activate the plugin. This simple plugin creates a called knowledge_base and a called section.
您需要做的第⼀件事是安装并激活插件。 这个简单的插件创建了⼀个称为knowledge_base和⼀个命名为section 。
This allows you to easily add your wiki articles and organize them into sections.
这使您可以轻松添加Wiki⽂章并将其组织成部分。
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 or a .
⾸先,将此代码段添加到主题的或于 。
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-li
// 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.
接下来,您需要做的就是创建⼀个新的WordPress页⾯,并在其中添加[knowledgebase]简码。 保存页⾯并预览。
It looks very plain right now, but we can add some styling to it. You can use this as starting point and then continue editing to match your own colors.
现在看起来很普通,但是我们可以为其添加⼀些样式。 您可以使⽤此作为起点,然后继续编辑以匹配您⾃⼰的颜⾊。
Paste the following code in your theme’s style.css file.
将以下代码粘贴到主题的style.css⽂件中。
.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.
这是在我们使⽤⼆⼗⼆⼗⼆主题的演⽰站点上的外观。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。