[wp-hackers] patch slug filter Re: New plugin for plugin authors to showcase their plugins on their site

Jean-Nicolas Kuttler wp-hackers at nicolaskuttler.de
Wed Jan 20 14:36:06 UTC 2010


Hello Mark,

I have added a patch to fix the following problem: I have a few plugins with badly chosen names and their page slug is different than the plugin name for SEO reasons. The patch:

diff --git a/i-make-plugins.php b/i-make-plugins.php
index a211b7d..bfa6bf0 100644
--- a/i-make-plugins.php
+++ b/i-make-plugins.php
@@ -61,6 +61,8 @@ function cws_imp_get_plugin_readme( $page_id ) {
 	$page = get_page( $page_id );
 	$slug = $page->post_name;
 
+	$slug = apply_filters( 'cws_imp_page_slug', $slug );
+
 	global $cws_imp_readme_cache;
 
 	// First, try in-memory cache

As you see it simply adds a filter that I can call from my theme.

The second patch just adds a little documentation that's probably important for some users. I'm not a good technical writer so feel free to change it!

diff --git a/readme.txt b/readme.txt
index afe4fc6..0906830 100644
--- a/readme.txt
+++ b/readme.txt
@@ -15,6 +15,8 @@ This plugin is for WordPress plugin __authors__, not __users__. It showcases you
 == Installation ==
 
 1. You're a plugin author. I really hope you know how to install plugins.
+2. There is a filter cws_imp_plugin_body that is run on the readme.txt before putting it on a page. You can use it to remove parts, inject plugin demo output etc. 
+3. If the slug for your plugin's page isn't the same as the plugin name you can use the cws_imp_page_slug filter to modify the page slug before this plugin tries to find a matching plugin.
 
 == Frequently Asked Questions ==
 
Thanks for this great plugin!

Nicolas

P.S. If you ever get around to looking into the unicode issue I wrote about on the list I would be very grateful.

On Sat, Jan 16, 2010 at 11:46:03AM -0500, Mark Jaquith wrote:
> Like many plugin authors here, I have many of my plugins in the wp.org
> repository, but I also want to showcase them on my own site. Until
> now, I've been managing them on my site manually. This has proved to
> be a giant pain — so much so that it makes me dread updating my
> plugins, as I know it'll involve a tedious update of their
> representative pages on my site.
> 
> I wrote a plugin to remedy this.
> 
> http://txfx.net/wordpress-plugins/i-make-plugins/
> 
> In order to make the page above, I did the following:
> 
> 1. Pages > Add New
> 2. Title: I Make Plugins
> 3. Parent Page: WordPress Plugins
> 4. Publish
> 
> That's it! It's getting all its info from the plugin repository, using
> the API calls available within WordPress. The info is cached in
> postmeta, with an expiration.
> 
> It also auto-populates the listing page:
> 
> http://txfx.net/wordpress-plugins/
> 
> Both pages have templates (using WP shortcodes, of course) so that you
> can customize their layout.
> 
> Now you can manage your personal plugins showcase just by updating
> their readme.txt file. Hope this is of some use to you!
> 
> -- 
> Mark Jaquith
>http://markjaquith.com/
>http://coveredwebservices.com/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

Nicolas

--
Nicolas Kuttler
wp at nkuttler.de


More information about the wp-hackers mailing list