Custom template for wiki page

Hi there,
I want to define a custom template for the wiki. how can I prevent it from using 'default' and redirekt it to one defined in my theme?

Goal is a full width wiki where the SubWiki links are in a column on the side instead of a sidebar.

I am also not getting how to implement the discussion feature as my theme does not include comments on pages per default. So I need to know where to past in the line
<?php comments_template(); ?>
to make the 'discussion' feature work.

Finally, will the chances affect the already defined wiki pages or just new once?

Thanks ans cheers, Alex

  • thisisafakename
    • Site Builder, Child of Zeus

    Ok, got the comments into the page BUT there is a PROBLEM. When I save/send the comment, the site redirects to e.g.

    http://sup.pe/blog/artikel/2012/07/endlich-ferien/comment-page-1/#comment-6

    So the wiki does think the user wants to view a wiki page with the name "comment-page-1/#comment-6" does not find it and jumps into the 'create new page' dialog.

    For me it would be fine if we could just switch of the 'does not exist, do you want to add the page' feature completely. Where in the code can I do this?

    The other question above are STILL OPEN.

    Thanks and cheers, Alex

  • Timothy
    • Chief Pigeon

    Finally, will the chances affect the already defined wiki pages or just new once?

    Creating a custom template in your theme wouldn't affect existing wiki pages, as in it wouldn't alter them.

    But all would be used by the template.

    To create a new template you can follow the WordPress method:

    http://codex.wordpress.org/Template_Hierarchy

    so:

    archive-wiki.php

    and

    single-wiki.php

    You will need to code the templates up yourself though. You may wish to use the existing ones as a template for this.

    If your ok with code then you will be able to achieve this otherwise you may need to hire a developer.

    Ok, got the comments into the page BUT there is a PROBLEM. When I save/send the comment, the site redirects

    Can I see an example of this? Perhaps some dummy access details to simply post a comment to witness what happens?

    Thanks.

  • thisisafakename
    • Site Builder, Child of Zeus

    Ok, to fix the comment problem and this 'create page if it does not exist' thing I need a piece of code that

    - checks a request for a wiki page (e.g. .../wikis/ancestor/unknown)
    - if the page is unknown, check the ancestors (e.g. .../wikis/ancestor/unknown)
    - then redirect the user to the first KNOW ancestor and show that wiki page

    please let me know how to make this happen.

    Also need to know who to create custom templates as mentioned in the codebase of the plugin.
    EDIT: Sorry just saw your answer on the theme thing, I will give it a try.

    Thanks and cheers, Alex

  • Timothy
    • Chief Pigeon

    That account doesn't have access:

    Unfortunately, some content on this website are reserved only for selected members.
    I'm very sorry for that we cannot serve you this time with something interesting.

    Maybe next time :slight_smile:

    Leider sind bestimmte Inhalte dieser Webseite nur ausgewählten Mitgliedern vorbehalten.
    Tut uns sehr Leid, dass wir Dir diesmal nicht mit etwas Interessantem dienen können.

    Vielleicht beim nächsten Mal wieder :slight_smile:

    Ok, to fix the comment problem and this 'create page if it does not exist' thing I need a piece of code that

    - checks a request for a wiki page (e.g. .../wikis/ancestor/unknown)
    - if the page is unknown, check the ancestors (e.g. .../wikis/ancestor/unknown)
    - then redirect the user to the first KNOW ancestor and show that wiki page

    please let me know how to make this happen.

    You may need to hire a developer for this part.

    Just so I understand you don't wish for the user to see a "create wiki" page if it doesn't exist and would like them sent to the slug before?

    Thanks.

  • thisisafakename
    • Site Builder, Child of Zeus

    "and would like them sent to the slug before?"

    Exactly, and how do I do that. The create new page thing is kind a new feature (see changelog), so there must be a way to disable it. As you can see, I have invested quite some time to make this look ok and work nice, so lets get this routing thing for unknown pages fixed, please. Please advice, thanks.

    Changed the permission, the link does work now, sorry.
    http://sup.pe/wikis/suppe-wiki/test/test-2/?action=discussion

    Cheers, Alex

  • thisisafakename
    • Site Builder, Child of Zeus

    Ok, I checked with your

    http://codex.wordpress.org/Template_Hierarchy
    so:
    archive-wiki.php
    and
    single-wiki.php

    and I have to tell you that it does not work - for several reasons, just read the wp doc and the code.
    archive-wiki.php // not allowed as described in wp spec
    single-wiki.php // its not using single

    the wiki uses the page.php template and the page-{post_type}.php is not allowed ether, just like archive-wiki.php

    The plugin code is a pain in the a.., to be straight forward.

    Please advice. Thanks, Alex

  • thisisafakename
    • Site Builder, Child of Zeus

    Changed this:
    // $wp_query->is_single = null;
    // $wp_query->is_page = 1;
    $wp_query->is_single = 1;
    $wp_query->is_page = null;
    and added:
    single-incsub_wiki.php
    to fix the first part.

    added archive-incsub_wiki.php which works for the wikis archive now, even the wp spec says sth. else.

    Now I am left with the category and tag list problem (how can I influence the template used and which is used at all)
    AND
    the fall back to a 'existing' page instead of the 'create new' wiki page.

    A little help would be much appreciated!
    Cheers, Alex

  • Timothy
    • Chief Pigeon

    "and would like them sent to the slug before?"

    Exactly, and how do I do that. The create new page thing is kind a new feature (see changelog), so there must be a way to disable it. As you can see, I have invested quite some time to make this look ok and work nice, so lets get this routing thing for unknown pages fixed, please. Please advice, thanks.

    If you are wanting the plugin to do something it wasn't developed to do then that really beyond the scope of support. You would need to custom code those extras, sorry.

    But looking at the file its this one:

    /wiki/default-templates/404-incsub_wiki.php

    So you could swap out the contents with something like:

    <?php wp_redirect( home_url() ); exit; ?>

    That would be the home URL, but you could do some custom code to grab the slug needed.

    I see you have the archive working with archive-incsub_wiki.php. The page type is indeed incsub_wiki and not just wiki as I previously mentioned. Sorry about that.

    Take care.

  • thisisafakename
    • Site Builder, Child of Zeus

    The plugin knows the redirect target I am looking for as it adds the 'create new' page result (the new wiki page) as a child to it. This means it needs just one line of code that does the redirect to that target instead of the 404 / 'create new' page.

    If that is not possible as support I will have to figure it out somehow in my own.

    This would actually make a nice admin option // new feature for the plugin :wink:

    Thanks for trying anyway. Cheers, Alex

  • thisisafakename
    • Site Builder, Child of Zeus

    Just read the title of the question again ...

    I could still not figure out how to define a custom template for
    - wiki category archive
    - wiki tag archive
    only for the wiki archive itself.

    Spend already 10 hours on reading code and trying things, so any advice is highly appreciated.

    Cheers, Alex

  • Timothy
    • Chief Pigeon

    I could still not figure out how to define a custom template for
    - wiki category archive
    - wiki tag archive
    only for the wiki archive itself.

    for the wikis archive, its using archive-incsub_wiki.php
    http://sup.pe/wikis/

    As an option for the tag and category page you could use the current files in your theme and then run conditionals.

    Or you could create a taxonomy file as mentioned on the link I gave earlier. The taxonomy for categories in Wiki is incsub_wiki_category. A Wiki tag is also a taxonomy incsub_wiki_tag.

    Take care.

  • Timothy
    • Chief Pigeon

    The plugin knows the redirect target I am looking for as it adds the 'create new' page result (the new wiki page) as a child to it. This means it needs just one line of code that does the redirect to that target instead of the 404 / 'create new' page.

    Sorry nearly missed this one.

    You would need to do some conditional statement to test against the content being pulled and if there is no wiki content then use the redirect else run the file.

    Take care.

  • thisisafakename
    • Site Builder, Child of Zeus

    You are the man!

    Thank you so much for the Taxonomy hint, I missed that option on codex.wp. Tested it and it works perfectly. Still not getting the page title as header but that is 'nice to have' for now.

    On the second answer ... I know what needs to be done but I got all this done without knowing any PHP. I got the redirect working to a staic target, so I classified the final solution also as 'nice to have' for now.

  • Timothy
    • Chief Pigeon

    Hey again.

    Thank you so much for the Taxonomy hint, I missed that option on codex.wp. Tested it and it works perfectly. Still not getting the page title as header but that is 'nice to have' for now.

    When you say as a header do you mean like <h1></h1>? Or do you mean like in the browsers tab for the page your on?

    It sounds like you just need to use the title function in the right place for the template.

    Glad to see you have the redirect working there. To get the parent permalink you could do something like this:

    $perma = get_permalink($post->post_parent);

    wp_redirect( $perma ); exit;

    I've not tested this, so it might need a little work.

    Let me know how you get on.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.