Make WordPress Core

Ticket #27286: 27286-plugin.php.diff

File 27286-plugin.php.diff, 1.6 KB (added by norcross, 11 years ago)

plugin.php file with additional function

  • plugin.php

     
    12801280        return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    12811281}
    12821282
     1283
    12831284/**
     1285 * Add sub menu page to a custom post type main menu.
     1286 *
     1287 * This function takes a capability which will be used to determine whether
     1288 * or not a page is included in the menu.
     1289 *
     1290 * The function which is hooked in to handle the output of the page must check
     1291 * that the user has the required capability as well.
     1292 *
     1293 * @param string $post_type The registered post type to add the new menu item to
     1294 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
     1295 * @param string $menu_title The text to be used for the menu
     1296 * @param string $capability The capability required for this menu to be displayed to the user.
     1297 * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
     1298 * @param callback $function The function to be called to output the content for this page.
     1299 *
     1300 * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
     1301 */
     1302function add_post_type_page( $post_type, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1303        return add_submenu_page( 'edit.php?post_type='.$post_type, $page_title, $menu_title, $capability, $menu_slug, $function );
     1304}
     1305
     1306/**
    12841307 * Add sub menu page to the media main menu.
    12851308 *
    12861309 * This function takes a capability which will be used to determine whether