[wp-hackers] Idea: Widgets as custom post types

Mike Schinkel mikeschinkel at newclarity.net
Fri Mar 5 18:06:29 UTC 2010


What exactly is being proposed?  Storing the widget *class* (i.e. the information about a text widget) or storing the widget *instance* (i.e. the text that the text widget will display)?

If the former then yes the wp_posts table is the wrong place.  If the latter then the wp_posts table is the right place because widget instances present content. And while the text widget is obvious other widgets are just as much content as text widgets.  If I have a list of events pulled from an API, for example, that list of events is content even though dynamically generated.

So my vote is that widgets should go into wp_posts because they are content.

-Mike
P.S. This begs a larger question of dynamically generated content, which many widgets produce.  Pages with dynamically generated content are also content yet they don't show up when searched.  So the question grows to become how to you recognize dynamically generated content in searches because people searching don't care how content is generated.


On Mar 5, 2010, at 10:55 AM, Matt wrote:

> Stephen,
> 
> The content vs. structure argument can go both ways. Text widgets contain
> *content* that you manage through WordPress. Before this discussion spirals,
> I agree that wp_posts isn't the best place to put widgets.
> 
> My point from earlier was that I'd prefer them *not* be stored as a big
> serialized string.
> 
> Widgets don't really fit into the posts table (as you and Otto mentioned),
> and I dislike the possibility of wp_posts columns being re-purposed to store
> data it wasn't meant to handle. Creating a wp_widgets table sounds
> reasonable.
> 
> BTW, since you're adamant against storing structure in wp_posts, what are
> your thoughts on how the new menu system stores its data?
> 
> Matt
> 
> On Thu, Mar 4, 2010 at 9:21 PM, Stephen Rider <wp-hackers at striderweb.com>wrote:
> 
>> 
>> On Mar 4, 2010, at 3:04 PM, scribu wrote:
>> 
>>> I plan to open a ticket once we discuss more about the best way to store
>>> widget instances individually.
>>> 
>>> Since I suppose a wp_widgets table is out of the question, I don't see a
>>> better place than the wp_posts table.
>> 
>> Why is a widgets table out of the question?
>> 
>> I'm not agreeing with the push to treat widgets as a type of post.  They
>> aren't data -- they're structure.  In essence they're part of the theme if
>> nothing else.  A very flexible part of the theme, but still -- part of the
>> theme.
>> 
>> They're not content, they're structure.  Treat it as what it is.
>> 
>> FWIW.
>> 
>> Stephen
>> 
>> 
>> --
>> Stephen Rider
>> http://striderweb.com/
>> 
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list