Add code to Functions.php

Yes.

It’s best practice to use a child theme and make your modifications there rather than edit the parent theme directly. This will allow you to to make changes without fear of overwriting your customizations.

From the Codex:

A child theme inherits the look and feel of the parent theme and all of its functions, but can be used to make modifications to any part of the theme. In this way, customizations are kept separate from the parent theme’s files. Using a child theme lets you upgrade the parent theme without affecting the customizations you’ve made to your site.