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.

Wordpress Chat
Wordpress chat?
3 comments
page 1308
Post Image The Easy Peasy Way
How to receive an image using post php?
26 comments
page 1065
Fun With Sidebar Tabs Styling
Tabs sidebar box?
2 comments
page 336
Post Image The Easy Peasy Way
Wordpress attachment url?
26 comments
page 1065
How To Add Sidebars To A Theme
How to register sidebar in wordpress?
10 comments
page 1053
Fun With Sidebar Tabs Styling
Alternate css in wp sidebar widgets?
2 comments
page 336
Using Your Own Url Shortener
Short url?
4 comments
page 1190
Post Image The Easy Peasy Way
Attachment picture in comments?
26 comments
page 1065
Doing More With Widgets Changing Layouts
Registersidebarwidget thematic?
6 comments
page 28
Using Your Own Url Shortener
Short links wordpress htaccess?
4 comments
page 1190
Html 5 Gallery
Html5 wordpress theme?
6 comments
page 1305
Updating Code Snippets Here
Fun wordpress sites?
no comment
page 1338
Dont Mess With My Toot Toot
Fun with toots?
15 comments
page 599
Dont Mess With My Toot Toot
Fun with toots?
15 comments
page 599
Post Image The Easy Peasy Way
Wordpress hook image size?
26 comments
page 1065
Post Image The Easy Peasy Way
Wp image get link of attachment?
26 comments
page 1065
Post Image The Easy Peasy Way
Wp get post attchements?
26 comments
page 1065
Photoshop Design Framework
Photoshop framework?
3 comments
page 296
Updating Code Snippets Here
Fun with wordpress?
no comment
page 1338
Post Image The Easy Peasy Way
Find the one we want based on its characteristics?
26 comments
page 1065
Why I Ditched Disqus
Disqus limitations?
5 comments
page 1175
Quick N Dirty Admin Login Screen
Login page css?
no comment
page 128
Quick N Dirty Admin Login Screen
Login page css style?
no comment
page 128
Wp Polls Reviewed
Different templates in wppolls?
one comment
page 58
Post Image The Easy Peasy Way
Php code add attachment wordpress?
26 comments
page 1065
Wordpress Chat
Chat para wordpress?
3 comments
page 1308
Photoshop Design Framework
Framework to photoshop?
3 comments
page 296
Post Image The Easy Peasy Way
Php get attachment from post?
26 comments
page 1065
Are Child Themes The Best Option
Wordpress thematic html5 child theme?
15 comments
page 1262
Are Child Themes The Best Option
Wordpress thematic html5?
15 comments
page 1262
Why I Ditched Disqus
Better than disqus?
5 comments
page 1175
Post Image The Easy Peasy Way
Wordpress imaged default url?
26 comments
page 1065
Are Child Themes The Best Option
Wordpress thematic html5?
15 comments
page 1262
  1 query every 1068 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 [...]