[wp-hackers] user-specified default post fields (was: keywords...)

Ryan Boren ryan at boren.nu
Wed Aug 11 19:52:27 UTC 2004


On Thu, 2004-08-12 at 01:42 +0800, omjn wrote:
> Hi folks,
> 
> I'm looking at ways of making WP do the things I want to do (rather than 
> what it wants me to do), and for this I really would find it helpful to 
> be able to have user-specified default posts in this manner.  It would 
> be great to have this feature in a future update, especially if it were 
> a part of the admin interface in a way that from a list of all available 
> fields the desired ones could chosen by radio buttons or something 
> similar.  I guess for now though, I'm going to have to try hacking 
> something in myself as I need this feature pretty quickly.  Anybody got 
> any tips as to where I should start looking in the WP code such that I 
> can change the default fields of new posts?  Or is it as simple as just 
> adding a global field to the mysql database?  I'll start trawling the 
> code for obvious calls, but any advice would be appreciated.

Look at the sample plugin I posted.  It can be extended to handle
however many custom fields a person could want.  Fields could be
packaged per plugin, as a set, or whatever.  No need to go hacking on
the core to get this now.  If someone wants a keywords field, enable the
keywords plugin.  

An advantage of plugins is that you can get real UI instead of UI auto-
generated from DB settings.  You also get UI that can be localized.

Ryan

> cheers
> 
> Michael Noble
> 
> 
> 
> Mark Jaquith wrote:
> 
> > I think a user-controlled setting would be best.  If you use a certain 
> > custom field a lot, you could just decide to have it always appear.
> >
> > This is a feature that Expression Engine has that really had me 
> > excited.  I think this would go a long way towards making WordPress 
> > capable of handling projects out of the range of a simple blog tool, 
> > but not big enough to warant a full-on CMS.
> >
> > On Tue, 10 Aug 2004 10:48am, Scott Merrill wrote:
> >
> >> jonner.1979671 at bloglines.com said:
> >>
> >>>  I think there's probably situations where you wouldn't want the field
> >>>  added to every post entry form (for example, if you had a ton of 
> >>> custom
> >>>  fields
> >>>  and didn't want your post form to be 10 pages long), so I think the
> >>>  existing
> >>>  interface could be kept, as long as a couple commonly-used fields 
> >>> could be
> >>>  designated as static.
> >>
> >>
> >> How about: when displaying the post form, query the DB for all those 
> >> keys
> >> that have been used more than X times (or add a counter for each meta 
> >> key,
> >> to ease the DB load) and dislpay those, on the assumption that you're 
> >> most
> >> likely to use them?
> >>
> >> Otherwise the post-meta table would need to modified to include a
> >> "default" (or "static" or "always") option, telling the post form to
> >> include it.




More information about the hackers mailing list