Update functions.php

Replaced deprecated function names and structures.