I'm working with a client who is wrapping the body of our WordPress site with their own external header and footer, stripping out our header and footer. Our enqueued plugin scripts then, aren't working because our header and footer aren't used at all. Also, it seems to me that NO plugins would work if they're not using our header/footer (not just the ones we've enqueued in functions.php). Is that true?
THIS DOESN'T WORK - YOU CAN SKIP IT UNLESS YOU JUST WANT TO READ IT. I talked with some smart folks at our Meetup about it, and they said I could print the scripts using the snippet below in my functions and they would then work again (mostly, but that this is a wonky work around). I've tried this, and so far it doesn't seem to be working. I would like to know why this should work - what does it do? If I understood it better, maybe I could figure out what is wrong.
function enqueue_scripts_the_wrong_way() {
printf( '<script src="%s/js/jquery.stellar.init.js" data-load-script="1"></script>', get_stylesheet_directory_uri() );
}
add_action( 'wp_footer_print_scripts', 'enqueue_scripts_the_wrong_way' );
WHY DO THIS ANYWAY? @norcross asked on Twitter if I would explain why the client needs this in the first place. It might be helpful to know I was only contracted to design/develop the WP theme I'll talk about. The client has an existing website, parts of which used a WP site (for their blog), and parts of which use a custom CMS. They are essentially a small business social network, and that site has a lot of dynamic content based on the user's logged in/logged out status, and that passes around user's info. They wanted to move the more static parts of that website, and the blog, entirely to one WordPress installation so the marketing dept could better manage it (apparently the custom CMS is a pain). BUT, the header and footer on the website contains some of that logged in/logged out context. I told them that WP could get their external user database and work with it, but that's more than I personally know how to do - however I know lots of devs who DO, and that when the time came, I would make the right introductions. They said it wouldn't be necessary because they could wrap the WP content with their header and footer, since essentially all they wanted from the WP install was the content. They have some folks who are familiar with WP working on the project, so I assumed that however they were doing this, they would know that they had to somehow maintain the integrity of the WP header and footer, but I was wrong. What we've ended up with is well, exactly what they said, their header and footer with our body content. The WP install does have the header and footer with the wp_head and wp_footer calls in it (that's all, though), but however their wrapper works, it's not using them.