Enrich Your WordPress Knowledge Regularly

Load custom template in WP User Frontend Account Page
First, you must create a wpuf folder inside your theme/child theme’s directory and create your custom template. Say I want to load a file called- custom.php
. Besides, I want to show a custom contact form, so I have already installed WPForms on-site.
Step 1: Content of the support.php
file
<style type="text/css">
.support-h4 {
margin: 0 !important;
color: #555558;
}
.support-p {
padding-top: 5px !important;
color: #666689;
}
.ccf {
padding-right: 26rem;
}
</style>
<div class="ccf-text">
<h4 class="support-h4">We are here to help</h4>
<p class="support-p">Our Team is at your complete disposal for any questions. Need some help? Fill out the form below and our staff will be in touch!</p>
</div>
<div class="ccf">
<?php global $current_user;
echo do_shortcode('[wpforms id="471"]'); //Render CF form
?>
</div>
Step-2: Now, create a custom section/menu and load the above template/file on the account page. To do that, use the below snippet to hook the template with the account page.
Note: you need to inject this snippet to your theme/child theme’s functions.php file. Else you can use a third-party plugin like “Code Snippets.”
//add menu/section
add_filter('wpuf_account_sections',function ($sections){
$sections['support-form'] = 'Support'; // add Support tab
return $sections;
},999);
// Load Support(load support.php template) on the WPUF Account page's section
add_action( 'wpuf_account_content_support-form', 'wpuf_my_support_form_section', 10, 3 );
function wpuf_my_support_form_section( $sections, $current_section ) {
// Load custom template
wpuf_load_template(
"support.php",
array( 'sections' => $sections, 'current_section' => $current_section )
);
}
Voila! It’s done.
Now visit your WPUF Account page, you will see your custom section “Support” with the content.



[…] If you want to customize your WPUF Account page, you can use the below filter/hook of the plugin to add a new Tab, delete an existing tab, update/rename an existing tab, or load a different template. […]