You do not need to change the functions.php for this. You need to add both options for the domain in the domain mapping and set the one with www. as default.
You do not need to change the functions.php for this. You need to add both options for the domain in the domain mapping and set the one with www. as default.