Leaving out wp_head()
-
I am somewhat new to WordPress theme development. I’m a little unclear on the role of wp_head() and the degree to which it (indirectly) adjusts page layout.
I have a site that is currently using the Twenty Fifteen theme. One of the pages I want to create is unique to the site – by design it looks quite different any of the pages in the theme. I do want to render as a WordPress page, though, so that I can later add widgets, edit the content, etc.
So, I created (let’s say) a mypage.php file the page and associated header-mypage.php and footer-mypage.php files. Initially these are virtually empty.
Here’s the part where I am a little confused. If I leave in wp_head() then the page has the left and right parts of the Twenty Fifteen theme, even though none of the aforementioned .php files implement this. If I take out the reference to wp_head() then my page renders just fine.
So, obviously I can just leave out wp_head() but I’ve read a number of times that I shouldn’t be doing that in a WordPress page – I need to give the chance for plugins to leverage hooks in referenced through wp_page().
I haven’t yet located WHERE the code is that is called from wp_head() that actually changes the layout of the page – all I know is that there’s some theme-level page layout that is affecting even the most empty of pages I create.
Should I just leave wp_head() after all?
Thanks.
Mark
The topic ‘Leaving out wp_head()’ is closed to new replies.