Skip to content

Instantly share code, notes, and snippets.

@sabbir1991
Created September 26, 2018 16:36
Show Gist options
  • Select an option

  • Save sabbir1991/91251b07f227febafa945d0cfe0abac2 to your computer and use it in GitHub Desktop.

Select an option

Save sabbir1991/91251b07f227febafa945d0cfe0abac2 to your computer and use it in GitHub Desktop.

Revisions

  1. sabbir1991 renamed this gist Sep 26, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. sabbir1991 created this gist Sep 26, 2018.
    31 changes: 31 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    <?php

    add_action( 'admin_menu', 'prefix_admin_menu' );

    function prefix_admin_menu() {
    global $submenu;

    add_menu_page( __( 'Project Manager', 'text-domain' ), __( 'Project Manager', 'text-domain' ), 'manage_options', 'awesome-pm', 'pm_dashboard_cb' );

    $submenu[ 'awesome-pm' ][] = array( __( 'Project', 'text-domain' ), 'manage_options', 'admin.php?page=awesome-pm#/' );
    $submenu[ 'awesome-pm' ][] = array( __( 'Message', 'text-domain' ), 'manage_options', 'admin.php?page=awesome-pm#/message' );
    $submenu[ 'awesome-pm' ][] = array( __( 'Settings', 'text-domain' ), 'manage_options', 'admin.php?page=awesome-pm#/settings' );
    }

    // For line number 8 callback function. where main single page div loaded
    function pm_dashboard_cb() {
    ?>
    <div class="wrap">
    <div id="vue-app"><div>
    </div>
    <?php
    }

    ===============================================================
    Output will be:

    Project Manager ----> Main menu : cause line no- 8
    - Project ---> Sub menu: cause line no- 10
    - Message ---> Sub menu: cause line no- 11
    - Settings -----> Sub menu: cause line no- 12