Multi-plugin Plugin

April 2, 2007 by aaron

Multi-plugin is a very simple script that allows you to add small bits of PHP scripts, such as WordPress filters, without having to make a plugin for them.

Download Multi-plugin

Installation is as simple as renaming the file to .php, uploading it to your server, activating it, and adding some script to the textbox (for example, I use the following code to remove the nofollow attribute from comments.)

<?php
add_filter(&#039;get_comment_author_link&#039;, &#039;aoi_follow&#039;);
add_filter(&#039;comment_text&#039;, &#039;aoi_follow&#039;);
function aoi_follow($link){
   return preg_replace(&#039;/(<a.*?rel[^>]*)nofollow(.*?)/&#039;,&#039;${1}${2}&#039;,$link);
}

?>

You can also use the following to add the trailing slash back onto feeds, categories, pages, etc. in WordPress 2.2+.

<?php
add_filter(&#039;user_trailingslashit&#039;, &#039;aoi_slashit&#039;,10,2);
function aoi_slashit($string, $type=&#039;&#039;){
  if($type == &#039;page&#039; || $type == &#039;category&#039;|| $type == &#039;month&#039;|| $type == &#039;day&#039;|| $type == &#039;paged&#039;|| $type == &#039;feed&#039;){
    return trailingslashit($string);
  }else{
   return $string;
  }
}
?>
Categorized as:
comments powered by Disqus