• Resolved _p_

    (@_p_)


    Hi

    I’m using the plugin with a Child-Theme and want to override the Template-Files. So I copied the plugin-folder “templates” to the Child-Theme and renamed it to “somfrp-templates”. But this is not working!

    The Plugin does not load the template files in the Child-Theme cause it is only looking for files in the (Main-Theme).

    You can fix this easily by chaning one line in one file.
    “includes/somfrp-functions.php”
    Line 560
    Search:
    $theme_path = get_template_directory();
    Replace:
    $theme_path = get_stylesheet_directory();

    Please fix this in the next release!

    Thanks and bye – Peter

    • This topic was modified 5 years ago by _p_.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi

    You can place this in your child theme functions. I also had the same problem. See https://www.ads-software.com/support/topic/great-plugin-shame-form-templates-cant-be-overridden-in-theme/

    // filter frontend password reset template for child-theme
    function filter_somfrp_get_templates($templates) {
    	if (get_template_directory() === get_stylesheet_directory()) {
    		// parent theme;
    		$theme_path = get_template_directory();
    	} else { 
    		//child theme; 
    		$theme_path = get_stylesheet_directory();
    	}
    	$templates = array(
    		'lost-form' => array(
    			'path' => SOMFRP_PATH . 'templates/lost_password_form.php',
    			'custom_path' => $theme_path . '/somfrp-templates/lost_password_form.php'
    			),
    		'reset-form' => array(
    			'path' => SOMFRP_PATH . 'templates/lost_password_reset_form.php',
    			'custom_path' => $theme_path . '/somfrp-templates/lost_password_reset_form.php'
    			),
    		'form-complete' => array(
    			'path' => SOMFRP_PATH . 'templates/lost_password_reset_complete.php',
    			'custom_path' => $theme_path . '/somfrp-templates/lost_password_reset_complete.php'
    			)
    	);
    	return $templates;
    }
    add_filter( 'somfrp_get_templates', 'filter_somfrp_get_templates', 10, 1 );

    I think the dev was gonna add this in but seems to have been missed. Maybe @rwebster85 could update on next release?

    Hope this helps.

    Plugin Author Richard Webster

    (@rwebster85)

    It will be in the next release very soon. The latest update was a priority security fix that needed to be sorted ??

    Nice one @rwebster85. Would be a good addition ??

    Plugin Author Richard Webster

    (@rwebster85)

    Version 1.1.91 now includes this ??

    @rwebster85 Many thanks for adding that in. Works like a charm ??

    Plugin Author Richard Webster

    (@rwebster85)

    Great stuff ?? if you haven’t already I’d appreciate it if you could leave a quick review.

    Is this also possible for the ‘includes/somfrp-functions.php’ file?
    So I can manage the error strings without any loco translate or something
    How can I fix that?

    • This reply was modified 4 years, 5 months ago by jarmogroeier.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Template Files In Child Theme Not Found’ is closed to new replies.