[wp-hackers] Theme development and hooks.

Owen Winkler ringmaster at midnightcircus.com
Fri Apr 8 18:41:17 GMT 2005


David Chait wrote:
> I guess 'the genie is out of the bottle' already.  I see providing new 
> templates in the future as further guidelines, but the reality is 
> different designers may have varying takes on how to build themes.  

> It's easier to add a bunch of variable/functions to the existing way 
> things are styled than to rewrite the code/css to >attempt< to comply 
> (as compliance isn't possible in all cases, frankly....).

Just to point out a glitch in this thinking- You're saying that 
designers inherently use different layout styles in CSS, yet you think 
it's still possible to maintain compatibility between styles by 
providing a translation table from one name to another?  Why not just 
standardize on a single set of names instead of complicating things with 
a translation table?

The *real* issue that will break this translation table idea is that 
designers can use additional/different tags to demark their content.  A 
prime example of this is the post ID that is attached to posts.  Logic 
would have the post ID for each post be written into the post <div>, but 
in the case of the themes packed with WordPress, they're in the post's 
<h3> title.

Where this complicates things (and why it would even matter to plugin 
authors at all) is if you use these things as IDs for DOM, you have to 
apply it differently for different themes.  On one hand (<h3>) you've 
got to use getElementById(postid).parentElement to get the post div, and 
on the other it's just getElementById(postid).  Who knows what radical 
differences there could be in other layouts!

Using the suggested translation table for the names of elements in this 
case isn't very helpful, since changing the id of the element (a 
difficult thing to do anyway, since it contains the post ID) isn't 
helping to find the correct element.

It seems necessary to me to first create a standard that delineates 
where a plugin can expect to find certain elements and what their names 
(ids) should be, then to create any needed translation services.

An alternative (and maybe this is what you're actually talking about) 
would be to include a table with every theme that describes how to find 
certain elements of the layout.  The table would be indexed by an item 
like "The element containing the entire post, including the title" and 
would provide some method for divulging that tag id based on the current 
post id.  It might work, but I think it's impractical, since publishing 
a standard would do essentially the same thing without forcing theme 
authors to go through the extra work of building a table for each theme.

Enjoying this discussion.

Owen





More information about the wp-hackers mailing list