In Chapter 2, Implementing Membership Roles, Permissions, and Features, we used direct file inclusions to load the necessary templates. A few chapters later, we improved the loading of templates by introducing a common template loader. Now, we can integrate the template loader into the user management functionality to keep the code consistent.
Let's apply the template loader instead of using direct template inclusions. Consider the template loading section of the display_registration_form function, as shown in the following code:
include dirname(__FILE__) . '/templates/register-template.php';
exit;
Now, we can take a look at the modified version with the support of the template loader object, as shown in the following code:
ob_start();...
$wpwa_template_loader->get_template_part('register');
echo ob_get_clean();