888888.888888.88""Yb..dP"Yb..8888b..Yb..dP.88b.88....db....8b....d8.88..dP""b8..dP"Y8
88__...88__...88__dP.dP...Yb..8I..Yb.YbdP..88Yb88...dPYb...88b..d88.88.dP...`".`Ybo."
88""...88""...88"Yb..Yb...dP..8I..dY..8P...88.Y88..dP__Yb..88YbdP88.88.Yb......o.`Y8b
88.....888888.88..Yb..YbodP..8888Y"..dP....88..Y8.dP""""Yb.88.YY.88.88..YboodP.8bodP'


88b.88.888888.888888.Yb........dP.dP"Yb..88""Yb.88..dP
88Yb88.88__.....88....Yb..db..dP.dP...Yb.88__dP.88odP.
88.Y88.88"".....88.....YbdPYbdP..Yb...dP.88"Yb..88"Yb.
88..Y8.888888...88......YP..YP....YbodP..88..Yb.88..Yb

October 7, 2008

I’ve been working on a new theme, which will be applied to this site after all the others, and because of the way I have created it I have had to call a lot of the hooks manually. For example, I am not using the template tag the_content, instead I am using apply_filters( ‘the_content’ , $this->post->post_content ); inside a function. This has made me think about the types of filters and actions we should expect to see in plugins.

There are conceivably three things that I might want to override with someone else plugin:

These can be achieved in a few different ways.

Assuming the data is retrieved using standard WordPress functions then being able to filter an array of default values before the query goes ahead should do the trick. This would allow plugins to be expanded to do things that weren’t originally intended.

Using callbacks to process data, and then filtering the name of that callback would allow significant parts of a plugin to be overriden; for example:

[php]
$callback = apply_filters('my_plugin_function_callback',array($this,'myfunction'));
$returned_data = array_filter ( $input , $callback );

Finally, using templates to output content, checking the current theme to see if there is an alternative template in the theme folder, and sending the template path through a filter before hand would give maximum flexibility.

How difficult or easy all this would be very much depends on the plugin. My question is whether we should built in this way and more importantly whether we should expect plugins to be as configurable as the core itself.

In my next post I will write a plugin that uses all of these techniques, and then modify it with a second plugin to demonstrate the benefits of this.

Quick N Dirty Admin Login Screen
Css login page?
no comment
page 128
What Wordpress Workflow Needs
Draft changes page wordpress?
3 comments
page 1226
Post Image The Easy Peasy Way
Wordpress add image size grayed?
26 comments
page 1065
Html 5 Gallery
Wordpress html5 photo gallery?
6 comments
page 1305
Quick N Dirty Admin Login Screen
Login page css?
no comment
page 128
Post Image The Easy Peasy Way
Get post image by id?
26 comments
page 1065
Why I Ditched Disqus
Formatting disqus code?
5 comments
page 1175
Six Million Ways To Die Choose One
6 esy ways to die?
14 comments
page 1128
Html 5 Gallery
Html 5 image gallery?
6 comments
page 1305
Wpunlimited The Ultimate Wordpress Theme
Ultimate wordpress theme?
3 comments
page 1141
What Wordpress Workflow Needs
Wordpress workflow?
3 comments
page 1226
Using Objects With Wordpress Plugins P 3
Wordpress class extends adminmenu?
5 comments
page 116
New Tabbed Widget Plugin
Comments widgets plugin?
no comment
page 333
Post Image The Easy Peasy Way
Wordpress function post image?
26 comments
page 1065
Html 5 Gallery
Wordpress themes html 50?
6 comments
page 1305
Wordpress Shortcodes What Why How
Wordpress shortcode?
no comment
page 236
Fun Without Cliches
Fun cliches?
12 comments
page 861
Post Image The Easy Peasy Way
Wp get post image?
26 comments
page 1065
Dont Mess With My Toot Toot
Custom content types wordpress?
15 comments
page 599
Wordpress Chat
Wp chat themes?
3 comments
page 1308
Post Image The Easy Peasy Way
Wp custom field arrau thumbnails?
26 comments
page 1065
Updating Code Snippets Here
Fun with plugins?
no comment
page 1338
Easy Peasy Images Suggestion Roundup
Display attached images within loop?
21 comments
page 1073
Post Image The Easy Peasy Way
Wp change post image size?
26 comments
page 1065
3 Ways To Speed Up Your Blog Without A Cache Plugin
Speed up disqus?
one comment
page 1321
Six Million Ways To Die Choose One
Simply ways to die?
14 comments
page 1128
Using Your Own Url Shortener
Use your domain as a url shortner?
4 comments
page 1190
Dont Mess With My Toot Toot
Dont mess with my toot toot?
15 comments
page 599
Post Image The Easy Peasy Way
Wp get attachment?
26 comments
page 1065
Post Image The Easy Peasy Way
Post image gallery wp?
26 comments
page 1065
Why I Ditched Disqus
Better than disqus?
5 comments
page 1175
Updating Code Snippets Here
Andy dp?
no comment
page 1338
Html 5 Gallery
Wordpress and html5?
6 comments
page 1305
  1 query every 1166 seconds, updated 1 seconds ago.
Wednesday, 12am
 __
(__)
   `

 Configurable Plugins | WP FUN

[...] should plugins should be written to be as extensible, if not more, as the core WordPress code; i.e. should we expect a plugin to be written with the expectation that someone will write a plugin to fur… I promised an example so here it [...]