• Hi

    Is there a way to have a snippet that overwrites the footer.php in a theme instead of editing the theme footer.php directly. This would be great at this will avoid losing any edits when the theme is updated.

    Thanks
    Doug

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Unfortunately, I don’t think it’s possible to prevent a template from loading, but you can add content to the theme’s footer.php file like this:

    add_action( 'get_footer', function ( $name ) {
    	if ( $name ) return; // this line ensures that content is only added to the main footer.php
    	?>
    
    	<p><code>footer.php</code> file content goes here</p>
    
    <?php } );
Viewing 1 replies (of 1 total)
  • The topic ‘Snippet for footer.php’ is closed to new replies.