Advertisement
jasonb4u

Add Extra Menu Links In MAINWP Dashboard

Nov 7th, 2021
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. ## Original Code below found here: https://meta.mainwp.com/t/nested-extra-menu/2081/3 , below code goes into Child Theme functions.php or into code Snippets plugin ##
  2.  
  3. add_filter( 'mainwp_main_menu', 'mycustom_mainwp_main_menu', 10, 1 );
  4. function mycustom_mainwp_main_menu( $left_menu ) {
  5. $index = 0;
  6. $sub_menu_after = array_splice( $left_menu['mainwp_tab'], $index );
  7. $addition_item = array();
  8. $addition_item[] = 'MORE LINKS'; /* Main TAB without link*/
  9. $addition_item[] = 'extras-item';
  10. $addition_item[] = ''; /* no need for link here*/
  11. $left_menu['mainwp_tab'][] = $addition_item;
  12. $left_menu['mainwp_tab'] = array_merge( $left_menu['mainwp_tab'], $sub_menu_after );
  13. return $left_menu;
  14. }
  15. add_filter( 'mainwp_main_menu_submenu', 'mycustom_mainwp_main_menu_submenu', 10, 1 );
  16. function mycustom_mainwp_main_menu_submenu( $left_submenu ) {
  17. $addition_item = array();
  18. $addition_item[] = 'Logout'; /* Link Heading */
  19. $addition_item[] = 'https://google.com'; /* new URL */
  20. $left_submenu['extras-item'][] = $addition_item;
  21.  
  22. /* Can Copy'n Paste below codes again into here to create a new link like this image snap: https://prnt.sc/1ylyzvh | https://prnt.sc/1ylz8x0 */
  23.  
  24. $addition_item = array();
  25. $addition_item[] = 'Support'; /* Link Heading */
  26. $addition_item[] = 'https://google.com'; /* new URL */
  27. $addition_item[] = ''; /* opens in new tab */
  28. $addition_item[] = '_blank'; /* opens in new tab */
  29. $left_submenu['extras-item'][] = $addition_item;
  30.  
  31. return $left_submenu;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement