• Resolved naveesh

    (@naveesh)


    Hi! Thanks for the awesome plugin.

    Can you help me a bit please? I followed that tutorial:

    https://wedevs.com/docs/wp-user-frontend-pro/developer-docs/add-a-new-tab-on-my-account-page/

    Added that code to functions.php:

    function wpuf_my_page( $sections ) {
    $sections = array_merge( $sections, array( array( ‘slug’ => ‘basecamp’, ‘label’ => ‘basecamp’ ) ) );

    return $sections;
    }

    add_action( ‘wpuf_account_content_my-page’, ‘wpuf_basecamp’, 10, 2 );

    function wpuf_addmypost( $sections, $current_section ) {
    wpuf_load_template(
    “dashboard/basecamp.php”,
    array( ‘sections’ => $sections, ‘current_section’ => $current_section )
    );
    }
    Then added that code to addpost.php:

    <?php global $current_user;

    echo “welcome to basecamp”;

    ?>
    The 4th menu item appeared, however welcome message doesn’t load. Where exactly should I upload addpost.php?

    /wp-content/themes/theme/wp-user-frontend/templates/dashboard/
    /wp-content/themes/theme/
    /wp-content/themes/theme/wp-user-frontend/
    Or is there anything else that I did wrong? Thanks!

Viewing 1 replies (of 1 total)
  • Hello there

    The code you have shared, I can see you have changed the slug.

    Please navigate through WP-content/plugins/wp-user-frontend/templates/ folder. Inside the template folder, create a file named basecamp.php.

    Then inside your basecamp.php file, please add the following custom code:

    <div class="wpuf-dashboard-container">
        <div class = "Welcome-message-for-basecamp">
        	<p><?php esc_html_e( 'Hello there!', 'wp-user-frontend' ); 
        	esc_html_e( 'Welcome to Basecamp', 'wp-user-frontend'); ?></p>
        </div>
    </div>
    

    Here is the code that you have to use in your child theme’s functions.php:

    function wpuf_my_page( $sections ) {
    $sections = array_merge( $sections, array( array( 'slug' => 'my-page', 'label' => 'Basecamp' ) ) );
    
    return $sections;
    }
    
    add_action( 'wpuf_account_content_my-page', 'wpuf_my_page_section', 10, 2 );
    function wpuf_my_page_section( $sections, $current_section ) {
    	wpuf_load_template(
    	   "basecamp.php",
    		array( 'sections' => $sections, 'current_section' => $current_section )
        );
    }

    regards,

Viewing 1 replies (of 1 total)
  • The topic ‘Custom section in account pagr’ is closed to new replies.