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

May 31, 2008

I have reached a point with the plugin that I am developing where I have been many times before. Most of the core functionality is done and I am deciding how to expose that to the users. Do I offer template tags or settings?

I am a big fan of the WordPress theme system and there is a good argument for suggesting that plugins should look to expand on the great work that has already been done by offering template tags wherever there is additional reader-facing content.

There are obviously some exceptions to this, there is no point creating a new tag for content that is modified in a certain way, just hook into the current tag, and plugins like the excellent Ajax Edit Comments that add content where the placement is a given (buttons below the comment text), but on the whole should we be aiming to create tags or not?

Here is the example from the plugin I am working on right now:

My plugin adds extra fields for the commenters to complete to show things such as which version of WordPress they are using. When their comment is displayed this information is displayed with the comment. I have included a test comment below just for fun.

The extra statement, that this comment relates to WordPress version x, is added with a comment tag right now, but I could just as easily provide an admin panel with the option to include it above or below the comment, and asking what separators and introductory text should be used.

So the question is this: is there a preferred method that plugin authors should aim for? Should we be avoiding admin panels when the same functionality can be produced using a template tag, as with most of the standard content, or should we be aiming for as seamless an experience as possible where no editing is necessary?

The third option, of course, is that there shouldn’t be a preferred method, but I dismiss that one. I feel there should be a target.

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 1067 seconds, updated 1 seconds ago.
Tuesday, 7am
 __
(__)
   `

 Andrew Rickmann

Trisha,

I do agree with you. I am coming round to the fact that making things as easy as possible is the best solution.

The technical, ordered, part of me though wants to extend WordPress so that my plugin works in the same way as the core, but it seems that isn’t the best thing for the users.

Monday, 5pm
 __
(__)
   `

 Trisha

I think adding a Settings would be better – the reason is that if you offer a template tag that needs to be inserted into a Theme file then SOME users will not be able to do this without messing up their Theme (a small minority, granted) however that still presents two other problems: 1) if the user switches Themes they will need to update every Theme they want to use, and 2) if the plugin is deactivated (for any reason) then the Theme can break – an invalid function call can prevent parts of the Theme’s files and styles from loading……..

Sunday, 8pm
 __
(__)
   `

 Andrew Rickmann

That’s a pretty interesting idea Kristin. One of my plugins uses ouput buffering to modify the code before it is output. In theory, it would be just as easy to load the file as a string, identify the relevent template tags, insert content before then and then eval the whole page.

I don’t think that is an ideal solution though, it is probably better for users to make a choice one way or another.

I have opted to go for the admin page simply because it is easier to explain to users.

Sunday, 6pm
 __
(__)
   `

 Kristin K. Wangen

The in-between could be to automagically add the code to the template, when the plugin is activated, and just tell your users that this is how it works.

Saturday, 11am
 __
(__)
   `

 Andrew Rickmann

Kristin, that was what I was thinking but it did occur to me that an admin page for every plugin might get overwhealming and that adding lots of processing where you could just insert the tags could have an adverse effect if every plugin does it.

Saturday, 9am
 __
(__)
   `

 Kristin K. Wangen

I think that you should as far as possible try to avoid any editing of template files. In my experience most people prefer the “upload the plugin and activate, and that’s all”-method.

I think the best solution would be both; you have an option page for the output, but if you want to edit template files you can do that.

Saturday, 8am
 __
(__)
   `

 Andrew Rickmann

This is the sample comment.

You can see above that I am using WordPress 2.5.x. The statement is added using a template tag. Should I be aiming to add it automatically using choices from the admin panel? or are template tags a good thing?