php – Prevent header and footer from loading on specific pages with template or plugin


I am working on a client’s site that has a few pages that are embedded into a mobile app through WebView. The goal is to prevent the header and footer from showing up on these certain pages. I can’t remove the get_header() function because I still need the styling and Javascript in the <head> element. I just don’t want the actual <header> element to appear. Currently my solution for this problem is a template that adds a CSS display: none snippet on the <header>, but I’d like to save resources by preventing the header source from even loading (through PHP). I understand that I can edit the theme files and just add a conditional to the header.php file. However, this issue has come up with multiple clients and therefore I need a way that can carry over to multiple different sites with the same theme, whether that’s through a template or a plugin.

micahlt 1 year 2021-09-28T15:51:28-05:00 0 Answers 0 views 0

Leave an answer