Advertisement
phpface

Untitled

Feb 1st, 2023 (edited)
1,225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. /**
  2. *   Add custom user dashboard menu items
  3. *   @param array $items
  4. *   @icons https://streamtube.marstheme.com/icons/
  5. *
  6. **/
  7. function streamtube_child_my_dashboard_menu_items( $items ){
  8.     $items['hello'] = array(
  9.         'title'     =>  esc_html__( 'Hello', 'streamtube-child' ),
  10.         'desc'      =>  esc_html__( 'Menu description', 'streamtube-child' ),
  11.         'icon'      =>  'icon-help-circled-1',
  12.         'callback'  =>  function(){
  13.             // Load template
  14.             //load_template( dirname( __FILE__ ) . '/hello.php' );
  15.             // OR write code directly, for instance
  16.             ?>
  17.             <p>
  18.                 <?php esc_html_e( 'Hello World', 'streamtube-child' );?>
  19.             </p>
  20.             <?php
  21.  
  22.         },
  23.         'parent'    =>  'dashboard',
  24.         'cap'       =>  'publish_posts',
  25.         'priority'  =>  50
  26.     );
  27.  
  28.     $items['google'] = array(
  29.         'title'     =>  esc_html__( 'Google', 'streamtube-child' ),
  30.         'desc'      =>  esc_html__( 'Menu description', 'streamtube-child' ),
  31.         'icon'      =>  'icon-link',
  32.         'url'       =>  'https://google.com',
  33.         'parent'    =>  'dashboard',
  34.         'cap'       =>  'publish_posts',
  35.         'priority'  =>  60
  36.     );  
  37.  
  38.     return $items;
  39. }
  40. add_filter( 'streamtube/core/user/dashboard/menu/items', 'streamtube_child_my_dashboard_menu_items', 10, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement