Get header outside of theme


I’m trying to get the theme’s header in a php file outside of the theme directory. Initially I found this solution -

I adjusted it like so -

define('WP_USE_THEMES', true);

The issue with this is it grabs not only the header but the body and footer. Using the code in the solution I linked grabs a header but not the theme’s header. Is there a better way of doing this with Sage in mind? It seems the way the theme compiles it’s hard to grab individual components outside of the blade views.


This topic was automatically closed after 42 days. New replies are no longer allowed.