I was tinkering around tonight with a theme idea and got to thinking (maybe too much).
I was relocating the “spPostAction” section and all it’s contents when I noticed a few if(function_exists) that were testing for active plugins, and then creating buttons for them if the functions exist.
This is fine and all if the theme authors were aware of each and every plugin out there that would require a button in the action section. Wouldn’t it be wise to come up with some sort of “standard” sections and provide standard hooks or filters that plugin authors could safely assume existed?
I’m not to keen on authoring a theme knowing I will have to review each and every new plugin to see if it requires a button. And then update the theme accordingly. I’d much rather make standard named sections with standard hooks, filters or both and leave it up to the plugin authors to hook into them.
Here’s a code example taken from the default theme wp-content/forum-themes/default/templates/spTopicView.php
sp_SectionStart('tagClass=spPostActionSection', 'action');
sp_GoToTop('tagClass=spRight spGoToTop&iconClass=spIcon', '', __sp('Go to Top', 'spDefault'));
sp_PostIndexNumber('tagClass=spLabelBordered spLeft');
sp_PostIndexEditHistory('tagClass=spButton spLeft', __sp('', 'spDefault'), __sp('Edited by %USER% at %DATE%', 'spDefault'), __sp('View edit history', 'spDefault'));
sp_PostIndexPermalink('tagClass=spButton spLeft', __sp('', 'spDefault'), __sp('Display post permalink', 'spDefault'));
sp_PostIndexPrint('tagClass=spButton spLeft', __sp('', 'spDefault'), __sp('Print this post', 'spDefault'));
if (function_exists('sp_PostIndexRatePost')) sp_PostIndexRatePost('tagClass=spLabelBordered spPostRating spRight');
if (function_exists('sp_PostIndexReportPost')) sp_PostIndexReportPost('tagClass=spButton spRight', __sp('Report', 'spDefault'), __sp('Report this post to admin', 'spDefault'));
sp_PostIndexQuote('tagClass=spButton spRight', __sp('Quote', 'spDefault'), __sp('Quote this post and reply', 'spDefault'));
sp_PostIndexEdit('tagClass=spButton spRight', __sp('Edit', 'spDefault'), __sp('Edit this post', 'spDefault'));
if (function_exists('sp_PostIndexSendPm')) sp_PostIndexSendPm('tagClass=spButton spRight', __sp('PM', 'spDefault'), __sp('Send PM to this user', 'spDefault'));
sp_SectionEnd('', 'action');