mydomain.com/wiki cannot work, but mydomain.com/wiki/myentry do works...

Dear WPMU,

I love this plugin,

two questions:

1. Why is that my mydomain.com/wiki cannot work, but mydomain.com/wiki/myentry do works...
ex: http://wptaiwan.org/wiki/
http://wptaiwan.org/wiki/wikicomparer/

2. Does it support left sidebar just like wikipedia -> like http://d.pr/Niv7

Thanks~!

dAb

  • DavidM

    Hi dAb,

    That's correct, the plugin doesn't actually do anything with the bare 'wiki' slug, though you can change the slug name.

    You could also use the Redirection plugin to redirect that 'wiki' slug wherever you like, perhaps creating a page that lists wikis or features various entries.
    http://wordpress.org/extend/plugins/redirection/

    And yes, the Wiki plugin is compatible with themes that have a left sidebar. It just depends on the theme you're using.

    Hope that helps!

    -David

  • dab

    Thanks for the reply.

    However, how to create a page that lists wikis or features various entries? Does Wiki plugin support shortcode to easily do that?
    Also, the Wiki widget didn't list the wiki page with indent layout to show the parent-child relationship of wikis, I think that should be a must do.
    And the Wiki use Entry not Page, so that I can't easily rearrange a left sidebar layout for it, for example when I use default BP theme.

    Thanks!

    dAb

  • kimedia

    Here is what I have done on my wordpress MU site:
    I did this because I wanted site owners to use wiki's optionally and have to do nothing other than create a wiki.

    So the aim was, when a site owner creates a wiki, add a link to the main navigation.
    Create a page on /wiki/ (or whatever slug the site owner has chosen) that lists the wikis.

    all within functions.php

    First of all hook into the main nav:

    function ki_media_add_menu_items($items, $menu)
    {
    global $blog_id;
    
    	 $result = new WP_Query(array(
        'post_type'=>'incsub_wiki',
        'post_parent'=>0,
        'post_status'=>'publish'
      ));
    
      if($result->have_posts())
     {
       $items .= '<li><a href="'.site_url('wiki').'">Wiki</a></li>';
     }
    
       $result = new WP_Query(array(
        'post_type'=>'forum',
        'post_parent'=>0,
        'post_status'=>'publish'
      ));
    
    if($result->have_posts())
    {
     $items .= '<li><a href="'.site_url('forums').'">Forums</a></li>';
    }
    
    	return $items;
    }
    add_filter( 'wp_nav_menu_items', 'ki_media_add_menu_items',10, 2 );

    (as you can see, the 2nd part of the function does the same but for forums).

    The next bit there is probably a more elegant solution, however this is what I came up with essentially coding top down for a quick hack.

    add_action('template_redirect', 'ki_media_load_templates' );
    
    function ki_media_load_templates() {
    	global $wp_query, $post, $wiki;
    
            //Get the site owner's slug
    	$slug = $wiki->_options['default']['slug'];
    
    	//check to see if connection is http or https
    	$http = 'http://';
    	if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) { $http = 'https://'; }
    
    	//build string to path
    	$path = $http.$_SERVER["HTTP_HOST"].$_SERVER['REQUEST_URI'];
    
    	//check to see if the page we are on is the root wiki
    	if($path == site_url($slug) || $path == site_url($slug.'/') )
    	{
    		//wiki-loop is a template file I have uploaded to my templates folder (this could also be uploaded to the wiki templates folder instead I believe)
    		 $templates[] = 'wiki-loop.php';
    		 locate_template($templates);
    		 require_once( locate_template($templates) );
    
    	}
    
    }

    I then created the wiki-loop.php which I uploaded to my templates folder (could also possibly be uploaded to the wiki plugin templates folder I think)

    <?php
    /**
     * The template for displaying all wikis.
     *
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    
    get_header(); ?>
    		<div id="primary">
    			<div id="content" role="main">
    <?php  $result = new WP_Query(array(
        'post_type'=>'incsub_wiki',
        'post_parent'=>0,
        'post_status'=>'publish'
      ));
     ?>
     <h2>Wikis</h2>
     <ul>
     <?php
    
       while ( $result->have_posts() ) : $result->the_post(); ?>
    				<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    
    				<?php endwhile; // end of the loop. ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_footer(); ?>
    <?php
    //this is because it is still a hack and I needed to stop the 404 message from appearing
    exit(); ?>

    The wiki query can be built to deliver the wikis in whatever order you want to whatever heirachy or number of children with a little editing.

    I have also put an exit(); on the end because I haven't gone for elegance with this code and wanted to stop it from throwing the 404 message at me.
    If anyone wants to tidy it up feel free.

    I hope this helps

  • Timothy Bowers

    Hey there! :slight_smile:

    Just checking in to see how things are going with this one and if you need any further help. :slight_smile:

    We haven't heard from you on this thread for a while. So I'm going to presume your all fixed up now and don't need any further assistance.

    However if you have more questions or need some more help then please feel free to respond in this thread or create a new one and we will be more than happy to offer assistance. :slight_smile:

    Take care.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.