WordPress.org

Ready to get started?Download WordPress

Forums

How to add admin menu and option pages to widget (similar to what NextGEN)? (2 posts)

  1. mtpultz
    Member
    Posted 2 years ago #

    Where do I add the option code at the top of this page here in the codex to the WP 3.0 widget built using the default usage from the codex here.

    I'd like to be able to build a few options pages and have them all under the same menu item in the admin menu, similar to what NextGEN gallery has in place. I've looked through their code but I can't figure out how they did it either. Anyone have a example or a page they know of where I can figure this out, most of what I've found is for versions of WP that use old APIs.

    Thanks

  2. mtpultz
    Member
    Posted 2 years ago #

    Okay, I guess I can drop it anywhere since this seems to work but now I can't figure out how to pull or update my Widget class' update function or am I supposed to create an options table and not use the update function anymore or is the widgets update page accessing a options page in the database that I can access?

    if (!class_exists("CS_CalendarSchedule"))
    {
    	class CS_CalendarSchedule extends WP_Widget
    	{
                ...
            }
    
    	add_action('admin_menu', 'my_plugin_menu');
    
    	function my_plugin_menu() {
    		add_options_page('My Plugin Options', 'My Plugin', '
    manage_options', 'my-unique-identifier', 'my_plugin_options');
    	}
    
    	function my_plugin_options() {
    		echo '<div class="wrap">my page</div>';
    	}
    }

Topic Closed

This topic has been closed to new replies.

About this Topic