Getting wp_footer() to work without wp_head()

For what it’s worth, I found a solution to my problem and posting it here for other lost souls 🙂

<?php
require_once("wp-blog-header.php"); /* setup the wordpress environment */ 

// This is to fool the system
// In order for wp_footer() to execute, we need to run wp_head() but since we don't want the output of the header again,
// we put it in a buffer, execute the function and then clear the buffer resulting in what we need
ob_start();
wp_head();
ob_clean();

require_once(dirname(__FILE__) . "/includes/footer.php"); 
?>

error code: 523