Is it safe to remove
get_footer();
from the index.php ?
I don’t need any footer.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Its not safe and not recommended. Thats action that read all Javascripts, CSS from other plugins or theme.
Hide your footer with css or theme option.
#footer,footer{display:none!important}
Method 2
Yes, it should be safe if you replace it with wp_footer(), which is the function that includes enqueued scripts in the page and other footer actions in the page. (and maybe optionally do_action( 'get_footer', null, array() ); first, in case you have anything that hooks that.)
But IMO the best / clearest thing to do would be to override footer.php in a child theme with a version that was just
<?php wp_footer();
and leave index.php calling get_footer() as usual.
However there’s still a risk that any of the theme scripts you have loaded assume the footer element always exists and try to access it. So please check you don’t have any script errors afterwards. If you do, you’d either have to fix the script or leave the footer on the page and use the display:none from the other answer.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0