Fixed bug with functions.php logic

move if statement to include function and callback