Template Override
-
Hi there,
First of all, great plugin! I'm trying to override login.php form with my own without modifying core plugin files. For this reason, I have created a child plugin following the same plugin structure (e.g. /wp-content/plugins/ajax-login-and-registration-modal-popup-pro-child-plugin/free/views/form-parts/login.php). I've placed the main .php file (login-registration-modal-pro-child-plugin.php) within the child plugin folder, telling WordPress to use this instead of the parent plugin. Here's the code I used:
<?php
// Hook to override the login form template in the parent plugin
add_filter('lrm/login_form_template', 'custom_login_form_template', 10, 2);
function custom_login_form_template($template, $args) {
// Check if the parent plugin is active
if (is_plugin_active('ajax-login-and-registration-modal-popup-pro/login-registration-modal-pro.php')) {
// Provide the path to the modified login.php in your child plugin
$template = plugin_dir_path(FILE) . 'free/views/form-parts/login.php';
}
return $template;
}
FYI, both parent and child plugins are active. However, this didn't work and login.php file was still loaded from the parent plugin which is not what I want because I want to preserve my changes even when parent plugin is updated. Could it be that I used the wrong filter? If so, could you please tell me correct one which renders login form and point me in the right direction to make this work.
Many thanks in advance!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.