Check if partial file is called from within header.php or footer.php

This is not a true solution to your problem (checking which template loaded another), but it will work to test if the footer has been loaded or not, and thus if it’s loading your partial:

if ( did_action( 'get_footer' ) ) echo 'footer-class';

Leave a Comment