We provide a way to easily add PHP into your template without it filling up your template file.
We think it is bad practice to put a lot of PHP code into your template directly. It makes it hard to read. That is why you can use the functions.php file to write any PHP code you need. It will be loaded before the template, so any variables will be available in the template. For example, if you want to add some code to check what menu item the current page is in order to provide some unique functionality, you can put the PHP logic in the functions.php file and set a boolean variable to use in the template.