Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

We will see here how to create a second wiki page for a certain category (or several categories if needed) : 

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"

Image Added

2) Search for the string:

Code Block
$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:

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



3) Create the page in WordPress:

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

Image Added

Categories in editing and creation

NOTE: This is possible from Woffice 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).

Makes 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 these, search for:

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

And add the id of the category in this way:

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

You can get the id of the wiki categories here:

Image Added

Repeat this for each new wiki template you have created.

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

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

And replace with:

Code Block
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 (thumbs up).

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