Looks like it is your if
statement possibly. It’s kind of tricky to say “if it’s not this or if it’s not that, then I want this to happen”.
Normally you have to negate and change the operator. Try
<?php if (!is_home() && !is_front_page()) { ?>
This says “I want this to run on every single page that is not home or front page”