• I built a image/video gallery for my own use. I didn’t build as a plug-in. I wrote it and plugged in the code where approipiate for it to work. But I’d like to port it to a plug-in structure.

    I’m curious how to add an extra menu item on the fly to menu.php. As you can see I hard coded ” array(__(‘Galleries’), 1, ‘galleries.php’) ” into the array from menu.php:

    $menu = array(
    array(__(‘Write’), 1, ‘post.php’),
    array(__(‘Edit’), 1, ‘edit.php’),
    array(__(‘Galleries’), 1, ‘galleries.php’),
    array(__(‘Categories’), 3, ‘categories.php’),
    array(__(‘Links’), 5, ‘link-manager.php’),
    array(__(‘Users’), 3, ‘users.php’),
    array(__(‘Options’), 6, ‘options-general.php’),
    array(__(‘Plugins’), 8, ‘plugins.php’),
    array(__(‘Templates’), 4, ‘templates.php’),
    array(__(‘Upload’), get_settings(‘fileupload_minlevel’), ‘upload.php’),
    array(__(‘Profile’), 0, ‘profile.php’)
    );

    Then in galleries.php I added Video & Image to the ‘adminmenu2’ options. The sub menu is easy cause it’s added in the file called but how ho I add items to the main menu when a plugin is activated? Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • function xgallery_admin_menu($content) {
    global $submenu;
    $submenu[‘options-general.php’][35] = array(__(‘xGallery’), 8, ‘xgallery/xgallery-options.php’);
    // $submenu[‘edit.php’][35] = array(__(‘xGallery’), 8, ‘xgallery-manage.php’);
    }

    // Hooks and filters for xGallery

    add_action(‘admin_menu’, ‘xgallery_admin_menu’);

    I stole the code from wp-list-links (sorry if thats not the correct name :P)

    Thread Starter zephyrsky

    (@zephyrsky)

    Zeeg, thanks for the response.. Unfortunately I tried this and it won’t show up in the main Admin bar.

    I’m using WordPress 1.2.1. Any other ideas?

    Thread Starter zephyrsky

    (@zephyrsky)

    Can this be done in 1.2??

    I’m seeing an admin_menu hook in 1.5, but it doesn’t appear that you can add Menu items on the fly from your module.

    Anyone?

    Not sure im using 1.5

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding Link to Admin bar’ is closed to new replies.