/** * @todo add context to the translations */ function register_menu_items() { //we rely on the register_post_type call to add our main menu items $parent_slug = foogallery_admin_menu_parent_slug(); //allow extensions to add their own menu items beforehand do_action('foogallery_admin_menu_before'); $menu_labels = apply_filters('foogallery_admin_menu_labels', array(array('page_title' => sprintf(__('%s Settings', 'foogallery'), foogallery_plugin_name()), 'menu_title' => __('Settings', 'foogallery')), array('page_title' => sprintf(__('%s Extensions', 'foogallery'), foogallery_plugin_name()), 'menu_title' => __('Extensions', 'foogallery')), array('page_title' => sprintf(__('%s Help', 'foogallery'), foogallery_plugin_name()), 'menu_title' => __('Help', 'foogallery')))); $capability = apply_filters('foogallery_admin_menu_capability', 'manage_options'); add_submenu_page($parent_slug, $menu_labels[0]['page_title'], $menu_labels[0]['menu_title'], $capability, 'foogallery-settings', array($this, 'foogallery_settings')); add_submenu_page($parent_slug, $menu_labels[1]['page_title'], $menu_labels[1]['menu_title'], $capability, 'foogallery-extensions', array($this, 'foogallery_extensions')); add_submenu_page($parent_slug, $menu_labels[2]['page_title'], $menu_labels[2]['menu_title'], $capability, 'foogallery-help', array($this, 'foogallery_help')); //allow extensions to add their own menu items afterwards do_action('foogallery_admin_menu_after'); }
/** * Helper function for adding a foogallery sub menu * * @param $menu_title * @param string $capability * @param string $menu_slug * @param $function */ function foogallery_add_submenu_page($menu_title, $capability, $menu_slug, $function) { add_submenu_page(foogallery_admin_menu_parent_slug(), $menu_title, $menu_title, $capability, $menu_slug, $function); }
function register_posttype() { //allow extensions to override the album post type $args = apply_filters('foogallery_album_posttype_register_args', array('labels' => array('name' => __('Albums', 'foogallery'), 'singular_name' => __('Album', 'foogallery'), 'add_new' => __('Add Album', 'foogallery'), 'add_new_item' => __('Add New Album', 'foogallery'), 'edit_item' => __('Edit Album', 'foogallery'), 'new_item' => __('New Album', 'foogallery'), 'view_item' => __('View Album', 'foogallery'), 'search_items' => __('Search Albums', 'foogallery'), 'not_found' => __('No Albums found', 'foogallery'), 'not_found_in_trash' => __('No Albums found in Trash', 'foogallery'), 'menu_name' => __('Albums', 'foogallery'), 'all_items' => __('Albums', 'foogallery')), 'hierarchical' => false, 'public' => false, 'rewrite' => false, 'show_ui' => true, 'show_in_menu' => foogallery_admin_menu_parent_slug(), 'supports' => array('title'))); register_post_type(FOOGALLERY_CPT_ALBUM, $args); }