Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Codex linking?

@ipstenu

Moderator

The destination URL would be http://wiki.mydomain.com/wiki/PAGE And it cleverly sees the spaces (like ‘Main Page’) and turns that into underscores (Main_Page).

<?php
/*
Plugin Name: Wiki Link
*/
add_action('post_text','wiki_link',200);
function wiki_link($text) {
$url="http://example.com/path_to_wiki/";
$wiki= str_replace(" ", "_", "$ 2");
$text=preg_replace("/([[(.+?)]])/si","<a class='wiki_link' href='$url$wiki'>$ 2</a>",$text);
return $text;
}
?>

It does eat that $2 doesn’t it…

Skip to toolbar