• Resolved backpackingseries

    (@backpackingseries)


    Hello,

    The current and default directory for custom forms is /childtheme/userswp. How can I change this please? I want to make it /childtheme/customization/plugins/userswp .

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Stiofan

    (@stiofansisland)

    Hello,

    the following filter is used so you can change it to what you like
    apply_filters('uwp_template_'.$type, $template);

    If you need some example of how to use the filter just let me know what template you are moving.

    Thanks,

    Stiofan

    Thread Starter backpackingseries

    (@backpackingseries)

    Thank you, Stiofan.

    Yes, examples of how to manage this would be very helpful. I plan to move all templates (login, registration, forgot pwd, profile, etc.) to this new directory structure.

    Kind regards

    Abhijeet

    Plugin Author Stiofan

    (@stiofansisland)

    You would use it as below, you can add more elseif statements for all the templates.

    add_filter('uwp_template_register','_my_uwp_template_change');
    function _my_uwp_template_change($template){
        if (strpos($template, 'registration') !== false) {
            $template = 'full/path/to/the/file/registration.php';
        }elseif(strpos($template, 'login') !== false){
            $template = 'full/path/to/the/file/login.php';
        }
    
        return $template;
    }

    Thanks,

    Stiofan

    Thread Starter backpackingseries

    (@backpackingseries)

    Thank you Stiofan.

    I tried the following. Seems like I am making an error though (code does not work).

    
    add_filter('uwp_templates','_my_uwp_template_change');
    function _my_uwp_template_change($template){
      if (strpos($template, 'registration') !== false) {
       $template = get_stylesheet_directory_uri() . '../relativepath/registration.php';
        }elseif(strpos($template, 'login') !== false){
            $template = '/absolutepath/login.php';
        }
        return $template;
    }
    $template = apply_filters('uwp_templates'.$type, $template);

    Any suggestions please?

    Kind regards

    Abhijeet

    Plugin Author Stiofan

    (@stiofansisland)

    You don’t need the last line of your code
    you also need to make a new line for each templeate (but it can call the same function)
    add_filter('uwp_template_TEMPLATE-NAME','_my_uwp_template_change');
    SO:

    add_filter('uwp_template_register','_my_uwp_template_change');
    add_filter('uwp_template_login','_my_uwp_template_change');

    If you need help applying things feel free to register and post on our own support forums where we can ask for temp login details (we are not allowed to ask on this forum) https://userswp.io/support/

    Thanks,

    Stiofan

    Plugin Author Stiofan

    (@stiofansisland)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change default directory for custom form templates’ is closed to new replies.