 Welcome to this lesson where we will explore global settings and styles for WordPress. With this lesson, you will describe the purpose of a WordPress themes theme.json file, familiarize yourself with the JSON format and the structure of theme.json, and understand the hierarchy used for loading the setting and style configurations of a website. So let's dive in. So why does a WordPress theme need a theme.json file? Theme.json is the configuration file for a theme. Now previously theme developers would have used the customizer to build out features for end users within their classic themes. Here for example, we have the classic theme 2021 and in this theme, we would have found the settings for colors and widgets within the customizer. So everything gets built out here on the left. And this is how end users work with the theme. Now with modern WordPress, we have block themes and theme developers can now use theme.json to provide those features to end users. So this provides a more consistent way of presenting features. Now here within the site editor, you can see the possibilities for the settings and styles that you can include in your theme. Let's take a step back now and take a look at the JSON format and the structure of theme.json. JSON stands for JavaScript object notation. JSON is essentially a data representation format. It's used for configuration files. It's a common format for sending and requesting data through a REST API and it's lightweight and easy to read. Now the supported data types are strings, numbers, floats, booleans, arrays and objects. With arrays, we always use a numeric index as we understand it in PHP as we see in this example here. And for objects, we use a key value pair as this example here illustrates. This is a list of quotes from Westworld. You can see the key value format I was just mentioning. Another thing to note is the key is always a string. In a code editor, you'll have these breadcrumbs here at the top and this is helpful for quickly navigating. Here I'm sitting at the first quote for Bernard Lowe. And so you can see that here as an array item. Another thing to note is with JSON, it's particularly picky about commas. So if I remove that comma, I get an error message. Here we have the theme.json file for the default theme 2024 and we've got these properties I'm going to go over now. So first is schema and that's used for defining the supported JSON and this is why we get the on the fly hints and error reporting. The next property is version and we're at two and you can always find this as a living reference on WordPress.org and it gives you the most up to date properties you can set. Next we have the settings. Settings is used to define your block controls, color palettes, font sizes and so on. After that we've got the styles property and that is used to apply items such as colors, font sizes, custom CSS and that's applied to the website and blocks. Under styles we have template parts and that is metadata for template parts to find in your themes parts folder. Next we have custom templates. That's metadata for custom templates defined in your themes templates folder. And finally we have patterns and this is a comma separated list of slugs to be registered from the pattern directory available to us on WordPress.org. Let's now take a look at the hierarchy used for loading the setting and style configurations of a website. The theme.json file included in your theme is only one level in a hierarchy of setting and style configurations for a website. Now this means that it can be overridden under certain circumstances. So I'm going to walk you through from lowest to highest the priority of this hierarchy. First we have WordPress. So within the installation files if you go to the wp-includes folder you'll see theme.json there and this file defines the default settings and styles. Next we have your themes theme.json file and anything you define in that file will override the WordPress defaults. If you have a child theme that is active and you have a theme.json file included in your child theme then anything that you do here will take precedence over the theme.json file in the parent theme. So for instance here I could set appearance tools to false. Next we have the user configurations. So within the site editor any changes that are added to the database through changes made to global styles or even templates and saved. This will override and takes priority over all other levels in the hierarchy. So this concludes the overview of global styles and settings. Much more detailed information is available within the intermediate theme developer learning pathway. Don't forget you can also visit the theme.json reference guide to further familiarize yourself with the.json schema.