Advertisement
fauzanjeg

Some Custom Change || Add new menu and content in Account Page

Mar 18th, 2021
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. /* Add New Menu to Account Nav */
  2. function add_custom_menu_account_nav( $endpoint ) {
  3.     $item = array(
  4.         'custom_menu' => array(
  5.             'slug'  => 'custom-menu',
  6.             'label' => 'custom_menu',
  7.             'title' => 'Custom Menu'
  8.         )
  9.     );
  10.     $endpoint = array_merge( $endpoint, $item );
  11.     return $endpoint;
  12. }
  13.  
  14. add_filter( 'jnews_account_page_endpoint', 'add_custom_menu_account_nav' );
  15.  
  16. /* Add Title to Account Content */
  17. function custom_account_right_title() {
  18.     // Insert Your Code Here
  19.     $accountpage = JNews\AccountPage::getInstance();
  20.     remove_action( 'jnews_account_right_title', array( $accountpage, 'get_right_title' ) );
  21.  
  22.     if ( $accountpage->get_current_page() === 'custom_menu') {
  23.         echo 'Custom Title';
  24.     }
  25. }
  26.  
  27. // add_action( 'jnews_account_right_title', 'custom_account_right_title', 9 ); // Default Title will follow title in function add_custom_menu_account_nav
  28.  
  29. /* Add The Content to Account Content */
  30. function custom_account_right_content() {
  31.     // Insert Your Code Here
  32.     $accountpage = JNews\AccountPage::getInstance();
  33.  
  34.     if ( $accountpage->get_current_page() === 'custom_menu') {
  35.         echo 'Hello';
  36.         echo '<br>';
  37.         echo do_shortcode( '[your_shortcode_handle]' );
  38.         echo '<br>';
  39.         echo do_shortcode( '[jnews_block_1 first_title="Example"]' );
  40.     }
  41. }
  42.  
  43. add_action( 'jnews_account_right_content', 'custom_account_right_content' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement