LLMS_Admin_Menus::submenu_order( bool $flag )
Remove the default menu page from the submenu
Parameters Parameters
- $flag
-
(bool) (Required) Flag from core filter (always false).
Return Return
(bool)
Source Source
File: includes/admin/class.llms.admin.menus.php
*/ public function submenu_order( $flag ) { global $submenu; if ( isset( $submenu['lifterlms'] ) ) { // Our desired order. $order = array( 'llms-dashboard', 'llms-settings', 'llms-reporting', 'edit.php?post_type=llms_form' ); // Temporary array to hold our submenu items. $new_submenu = array(); // Any items not defined in the $order array will be added at the end of the new array. $num_items = count( $submenu['lifterlms'] ); foreach ( $submenu['lifterlms'] as $item ) { // Locate the desired order. $key = array_search( $item[2], $order, true ); // Not found, increment the number of items to add it to the end of the array in its original order. if ( false === $key ) { $key = ++$num_items; } // Add the item to the new submenu. $new_submenu[ $key ] = $item; } // Sort. ksort( $new_submenu ); // Remove the keys so the new array doesn't skip any numbers. $submenu['lifterlms'] = array_values( $new_submenu ); } return $flag;
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Adds custom sorting for LifterLMS submenu items. |
3.2.0 | Unknown. |
1.0.0 | Introduced. |