Okay
  Print

Create a multiple Wiki Pages

Important

This article is outdated. Woffice has a new documentation here: 

https://alkaweb.atlassian.net/wiki/spaces/WOF/overview

If anything is missing, let us know and we will improve it. It was designed to be searchable, more organized and more complete. 

------


We'll see here how to create a second wiki page for a certain category (or severals) : 

1) You have to create a new php file for each category (group) that you need. You have to clone the page:

woffice/page-tempaltes/wiki.php 

As "wiki-group-1" for instance

and replace the template name writing something like "Wiki group 1", "Wiki group 2"

2) Search for the string:

$wiki_display = new Woffice_Wiki_Display_Manager(0);

And replace the 0 with the id of the wiki that you want to display in this new template.

If you want to add more categories on a certain page, you can pass the IDs as an array, like this:

$wiki_display = new Woffice_Wiki_Display_Manager( array(1,2,3) );

For version 2.3.1 or earliler:

Once saved, you'll see a new page template in your page's template box ;)


For version older than 2.3.1:

2) You have to search for the foreach

foreach($categories as $category) {

Then you'll have to include the WHOLE content of the foreach in an IF statement:




3) The if statement will be:

if($category->slug == 'wordpress') {

and you have to replace in each page the string wordpress, with the slug of category that you want display on this page.

Categories in editing and creation

NOTE: This is possible from version 1.8.1

If you stop now the customization, when an user try to ceate a new category or edit a current one, he will always able to select EVERY wiki category of your site, also categories of another wiki group (another parent).

Make sense that you want avoid this, if you want you have to open again the php files you have created for every wiki groups (the different templates)


In this files, search for:

<?php woffice_frontend_render('wiki',$hasError); ?>

and add the id of the category in this way:

<?php woffice_frontend_render('wiki',$hasError, 10); ?>

You can get the id of the wiki categories here:

Repeat this for each new wiki template you have created.

After, open file single-wiki-php, search for:

$terms = get_terms('wiki-category', array('hide_empty' => false));

And replace with:

global $post;
$parent  = get_the_terms ($post->ID, 'wiki-category');
$terms = get_terms('wiki-category', array('hide_empty' => false, 'child_of' =>$parent[0]->parent));

All done.

If you have questions or you need help, just open a new ticket.