How to use custom footer template in a site-plugin?
I have a site-plugin to centralize most of the theme customization. I want to override the default footer.php template with a customfooter.php (removes the Proudly Powered by WordPress) stored inside the /plugins directory structure. I found this resource on StackExchange, one here, and tried some. Obviously, I am making errors. Could someone please advise how to achieve this without touching the theme files / directories?
add_filter( 'theme_page_templates', 'force_customization', 101 );
function force_customization( $newtemplate ) {
if ( is_singular( 'footer' ) ) {
$newtemplate = plugin_dir_path( __FILE__ ) . 'customization/customfooter.php';
}
return $newtemplate;
}
Any / all help is welcome.
Kind regards
Abhijeet
Topic page-template plugin-development customization plugins Wordpress
Category Web