To separate your admin page into separate tabs you can use the following for your page

Pre HTML Output
  //----- SETUP FOR TABBED PAGE CONTENT -----
  $tab = isset($_GET['tab']) ? intval($_GET['tab']) : 0;
	$tab_Selected = array();
	$tab_Selected = array_fill(0, 5, "");		//Fill an array from index 0, # items long, with default value ""
	$tab_Selected[$tab] = "nav-tab-active";
HTML Output

  $HtmlOutput = '';
  
  //START OF PAGE
  $PageTitle = get_admin_page_title();
  $HtmlOutput .= <<<_END
    <div class="wrap">
      <h1>$PageTitle</h1>
    
      <!-- Page Tabs -->
      <nav class="nav-tab-wrapper">
        <a href="?page=MY-PAGE-SLUG" class="nav-tab $tab_Selected[0]" >TAB_NAME_0</a>
        <a href="?page=MY-PAGE-SLUG&tab=1" class="nav-tab $tab_Selected[1]" >TAB_NAME_1</a>
        <a href="?page=MY-PAGE-SLUG&tab=2" class="nav-tab $tab_Selected[2]" >TAB_NAME_2</a>
      </nav>

      <div class="tab-content">
_END;

  if ($tab == 0)
  {
    //-----------------------------
    //-----------------------------
    //----- TAB 0 -           -----
    //-----------------------------
    //-----------------------------
    $HtmlOutput .= <<<_END
      This is tab 0 content
_END;
  }
  else if ($tab == 1)
  {
    //-----------------------------
    //-----------------------------
    //----- TAB 1 -           -----
    //-----------------------------
    //-----------------------------
    $HtmlOutput .= <<<_END
      This is tab 1 content
_END;
  }
  else if ($tab == 2)
  {
    //-----------------------------
    //-----------------------------
    //----- TAB 2 -           -----
    //-----------------------------
    //-----------------------------
    $HtmlOutput .= <<<_END
      This is tab 2 content
_END;
  }
  
  //END OF PAGE
  $HtmlOutput .= <<<_END
      </div>  <!-- <div class="tab-content"> -->
    </div>    <!-- <div class="wrap"> -->
_END;
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *