• 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’ => ‘addmypost’, ‘label’ => ‘Добавить пост’ ) ) );

    return $sections;
    }

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

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

    <?php global $current_user;

    echo do_shortcode(‘[wpuf_form id=”1048″]’);

    ?>
    The 4th menu item appeared, however shortcode 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!

    My site is https://pokupaem-kg.ru

Viewing 1 replies (of 1 total)
  • Hello @naveesh,

    Say you want to add a post form inside the new custom tab, so this is how you have to write the code inside your child theme’s functions.php file:

    add_filter( 'wpuf_account_sections', 'wpuf_product_page' );
    
    function wpuf_product_page( $sections ) {
    $sections = array_merge( $sections, array( array( 'slug' => 'addmypost', 'label' => 'Submit Post' ) ) );
    
    return $sections;
    }
    
    add_action( 'wpuf_account_content_addmypost', 'wpuf_product_page_section', 10, 2 );
    
    function wpuf_product_page_section( $sections, $current_section ) {
    
     echo do_shortcode('[wpuf_form id=”1048″]'); 
    
    }

    regards,

Viewing 1 replies (of 1 total)

The topic ‘Wp user custom post type’ is closed to new replies.