[wp-hackers] Admin menu hook

Owen Winkler ringmaster at midnightcircus.com
Thu Nov 25 03:31:37 UTC 2004


Kitty wrote:

>Ok, finally got around to beating on this some. So far a couple of
>things have come up.
>  
>
Maybe I'm missing something fundamental here, but...

Why do what you're suggesting instead of this:
http://wordpress.org/pipermail/hackers_wordpress.org/attachments/20041018/9bd317f6/test.bin

The line with echo "<p>" could easily include other files as needed, 
including ones in subdirectories.  Your whole plugin, subdirectory and 
all, could drop into wp-content/plugins without issue.

And if you wanted to add your submenu explicitly to the Plugins page and 
not the Options page (which seems to be a faux pas), you could simply 
replace the add_options_page() with something that adds to the Plugins 
page, like this code:
$submenu['plugin.php'][] = array('Title', 9, 'plugin-admin.php' );

Your submenu highlight should still work if you go this route.  The menu 
code is only checking for the value of $_GET['page'] to determine the 
highlighting, so whatever action you want to add shouldn't interfere.  
There should also be no issue with the admin CSS, since the plugin is 
only supplying the HTML that the admin.php page is inserting between the 
admin header and footer.

Maybe you missed Ryan's message, Kitty?  Or did I misinterpret your 
intentions, and thie really doesn't apply?  Or maybe I'm just insane...

If you want to see an example of this menu stuff working, my OSA plugin 
(http://www.asymptomatic.net/wp-hacks) uses it, or you could check out 
Dr. Dave's excellent descendant of my own code, Spam-Karma 
(http://unknowngenius.com/blog/archives/2004/11/19/spam-karma-merciless-spam-killing-machine/).

Owen





More information about the hackers mailing list