[wp-hackers] Class for WP-Admin Menus

Chuck Guenther chuckg at blindmuse.com
Thu Aug 5 00:07:38 UTC 2004


The cg_adminMenu class is basically a method for adding both new links 
to pre-existing menu's (in the case of adminmenu *the main links* or 
adminmenu2 *the smaller, page specific links*) or to create a 
"submenu" on pages that do not have it.  Right now there isn't a way for
plugin authors to access the menu in the administration console except
through the DOM.  Personally, I don't think this is very classy because
the links tend to not fit with the basic layout of the WP-Admin console.
So, what I've done is write this class that will extend or *create* any
menu that does not already exist.  Think of the "Options" panel; there
are the "General", "Writing", "Reading","Permalinks", etc. links, right?
Well what if an author wants to add options for his/her plugin but
doesn't want to code it through the plugins "thingo-mo-wacker" (I'm not
good w/ technical words).  Well, with this class, adding a link to that
submenu (it's actually a ul def with the id adminmenu2, but you get the
idea) is a cinch. 

I wrote this class so that I could add new links to the "Upload" area
and make it seamless for the user to add my plugin. So for my plugin, I
just created the submenu (since it didn't already exist) and voila, the
user has 0 to edit in terms of WP files.

Currently the code is packaged in a "plugin" because it's easiest for me
to mess around with in that context, but really it can be included in
any plugin you wish. Basically, I'd like to see what you plugin authors
out there think of this class and whether or not it functions as I think
it does on my test environment.  The class can be found here:

http://blindmuse.com/code/wordpress/cg_menuAdd.phps

Right now I guess it's licensed under the Creative Commons, but I don't
really know what that means or entails. Suggestions on that as well?

chuckg

-----------------
http://www.blindmuse.com
I am who I am not who I thought I am
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : /pipermail/hackers_wordpress.org/attachments/20040804/92cb2195/attachment.bin


More information about the hackers mailing list