How to add a code to the theme header or footer
We do not recommend the alteration of the theme files. This can cause malfunctions and can break the theme functionalities. If need to make code customizations, the Child themes are the recommended way of modifying an existing theme.
If you are not a developer and you're are not familiar with deep theme customization using the child theme, or you are simply looking for a small task as adding Facebook pixel code to the header theme or something similar:
Follow the next steps to add a code to the theme header without touching the code.
Install a dedicated WordPress plugin which helps you to add codes to the theme header. In this example we will use this plugin:
Insert Headers and Footers.
WP Admin > Settings > Insert Headers and Footers