One of the most unique methods for WordPress typography using theme.json

Nov 19, 2024
Revolutionizing WordPress Typography with full site editing and theme.json

-sidebar-toc> -language-notice>

Words are the basis of the Internet, despite the multitude of digital mediums. The fonts you pick for your website are the most important element in the layout and design of your website.

WordPress typography is able to create moods, assist with branding, and so on. Full editing online (FSE) is one of the features of WordPress lets you customize the typography you want to use accessible to users. Additionally, WordPress' theme.json document helps designers create WordPress themes that take advantage of this feature.

The article concentrates on WordPress typography, which includes FSE as well as theme.json. This article also includes a discussion of key factors such as the typeface you choose to use, as well as the technical elements that need to be taken into consideration in addition to the general guideline to follow in how you can use typography within your style of our website.

Typeface online: a short history

If you look over the first designs on the internet It will be apparent that despite the different styles that the fonts were uniform in their appearance. This was due to accessibility and the necessity. If you do not possess the most recent internet technology and the fonts that appear on the web could be limited to the fonts installed on your personal computer.

In the mid to late 1990s "web user" was limited to a couple of fonts with a certain style: Times New Roman, Arial, Helvetica, Georgia and Verdana. Two of them are Microsoft commissions that are perfectly acceptable for use on internet regardless of date.

A comparison of two serif typefaces, Verdana and Georgia. The image shows uppercase and lowercase letters – as well as numbers – in both fonts. Verdana appears more condensed and geometric, while Georgia has more pronounced serifs and a slightly more traditional look.
The fonts used are the Verdana font, as well as Georgia fonts.
The Google Fonts website showing font previews and filtering options. The preview text reads, "Everyone has the right to freedom of thought," displayed in different fonts, including Roboto, SUSE, and Noto Sans Hannunoo. Filter options for language, writing system, and font properties are visible on the left-hand sidebar.
The main Google Fonts interface.

WordPress and typography

Modern default themes utilize classic font stacks to create modern, elegant and professional looks. The older default themes employ combinations such as Noto Sans as well as Noto Serif (for Twenty Fifteen) and Montserrat as well as Merriweather (for Twenty Sixteen).

Visual representations of The "circle of the globe", Twenty Sixteen uses Helvetica as well as Georgia as options for fallback. Its Twenty Ten default theme is based on Helvetica, Arial, and Georgia:

The WordPress.org theme preview for "Twenty Ten" displaying a scenic header image of a tree-lined path. The left-hand sidebar shows theme information and download options, while the main area presents sample content and layout.
Twenty Ten demo page is accessible on WordPress.org. Twenty Ten demo page is accessible via WordPress.org.

These options provide the basis for WordPress style within every theme, they can also prompt you to pay attention to how you use typography. This is something which WordPress FSE can assist you in.

A summary of the primary changes to the site in conjunction with theme.json

The WordPress Site Editor interface displaying a landscaping company's homepage. The page has a blue background with white text reading
The interface of the user for WordPress Site Editor has a similar interface the one used by Block Editor. Block Editor has an expanded scope of customization.

Your website's design offers unified options with a variety of possibilities:

  • The editing technique is in the creation of Blocks which covers the entire site and not just the pages you publish.
  • Template libraries are an essential part of setting up. They allow users to modify them using the same equipment you've used for making the material you've created.
  • The styling process is also part of the Site Editor, and provides a general setting of the style.
  • Editing sites doesn't require any code to use some of the choices available. It's an intermediary between development and design.

You can imagine the theme.json file to be a type of model for FSE. It requires JavaScript Object Notation (JSON) capabilities to work with the file, but it's an option for the vast majority of webmasters. It's the central configuration file which regulates your styling and configurations.

A code editor window titled is displayed over a scenic background of forested mountains. The editor shows a portion of a WordPress theme.json file with various styling configurations. The code includes settings for calendar, categories, and code elements, using CSS variables for colors and spacing. Line numbers are visible on the left, and the editor interface has a dark theme for improved readability against the backdrop.
The theme.json document will be shown with an editor specifically designed for programming.

Every setting depends on the key value value:option which lets you use this using a range of choices:

  • Defining global color palettes.
  • This is the process of developing font families and dimensions.
  • Modifying the block-specific style.
  • Controlling spacing and layout preference.

The fonts can be edited in the WordPress Site Editor

If you're happy with the process of using the Block Editor is fine to use it using The Site Editor. Inside WordPress, navigate through your designand after that, you'll be capable of accessing your editor screen. The editor screen is home screen of The Editor of your Site.

The WordPress Site Editor home screen. The left-hand sidebar shows design options, while the main area displays a blue-themed homepage with the heading "A commitment to innovation and sustainability" and an image of a modern building.
It's The Home Screen of Site Editor.

The Styles display on the left side of the navigation gives you a variety of styles that can be used in a variety of fonts, which alter:

A GIF of the WordPress Site Editor showcasing various theme style presets. The main content area displays "A commitment to innovation and sustainability" with a description of Études firm. It changes the color scheme and typography based on the selections within the left-hand sidebar, which shows style options and color schemes.
There's a wide variety of styles available for The WordPress Site Editor. WordPress Site Editor.

In most cases the individual setting for different aspects of typography may be the best option. Two tiny icons on the Styles screen reveal more choices, such as Style Book and Edit Style Book along with the editing styles pencil icons.

A portion of the WordPress Site Editor showing style options on the left-hand side, and a preview of the website on the right. Two icons for viewing and editing are highlighted in red.
The icons for Editing Style within the Editor for Site.

Furthermore, you get the possibility of specifying fonts and styles on an elements level, and also for each Block.

Font Library The Font Library Font Library

The editing style>>The Typeography screen will display The Font Library but it does not include this specific type in edit Styles that are available for Sites. You can manage the different fonts and types in various ways:

  • You are able to download and organize fonts you've designed.
  • You are able to utilize Google Fonts directly within WordPress.
  • Create collection of fonts by using PHP.

To access the Font Library, navigate to the category for typography on the site Editor sidebar. Then, click"Manage Fonts": control your Fonts symbol:

The Typography settings panel within the Site Editor showing font options, including Cardo, Jost, System Sans-serif, and System Serif. A Manage fonts button is highlighted in the top right corner. The panel is displayed alongside a blue website background containing Latin text, demonstrating the applied typography styles.
The control Fonts icon can be located within WordPress's editor. WordPress website editor.

The place to find the tab linking to libraries can be found. The library tab lists the fonts being registered for the theme you are using. The library tab also shows the typefaces that are active.

The WordPress Font Library interface displaying installed and theme fonts. Merriweather Sans is listed as an installed font with four active variants. Theme fonts include Cardo, Jost, System Sans-serif, and System Serif, each with their respective active variants.
The WordPress Font Library user interface. WordPress Font Library interface.

If you pick one it will allow you disable or activate each one.

The Font Library selection dialog box displaying options for the Cardo font family. The dialog shows three variants: Cardo Normal, Cardo Bold, and Cardo Normal Italic, each with a checkbox selected. Above the variants, there's a note cautioning that too many font variants could slow down the website.
The latest fonts that are accessible on the site Editor's Font Library.

If you select an upload option, you will be able to use an uploader, which permits users to drag and drag documents. You can download your favorite Fonts for TTF as well as WOFF formats in addition to WOFF, and OTF formats.

The WordPress Font Library showing options to install Google Fonts. The search bar lets users find specific fonts, and a list displays various font options including Merienda, Merriweather, and Metal Mania. Pagination controls are visible at the bottom.
It's part of The Google Fonts library within the WordPress Site Editor.

Choose the fonts that you would like to download from the huge selection and click to click the download button. When the confirmation is received it will show the fonts visible on the Library tab:

The WordPress Font Library displaying installed and theme fonts. Merriweather Sans is listed as an installed font with four variants active. Theme fonts include Cardo, Jost, System Sans-serif, and System Serif, each with their respective active variants.
The fonts that are used in the WordPress instance.

It lets you use the same fonts as any other font you have on your site. Then, you'll need to modify them to fit your requirements.

The Style Book

One of the issues in choosing and setting fonts is that it's difficult to be certain of how the font would be like if you combine color schemes, layouts as well as other styles. This Style Book is invaluable, as it permits you to examine the possibilities of typography of different components.

The WordPress Style Book editor interface showing a blue background with "Code Is Poetry" repeated in different font sizes as headings. The right-hand sidebar displays style options for typography and elements.
The Style Book of the Site Editor.

The click on the eye icon will open the Style Book, and there five tabs in the Style Book:

  • Text Visit this page for instructions on how to use headings, paragraphs, and lists as well in other elements that focus on text.
  • Media In this part you can modify the audio and video, along with the audio and images.
  • Design The site combines the basic elements of the site, including buttons, separators and columns.
  • Widgets The HTML0 widgets contain two components that are displayed, such as dynamic generation for collections of archives or even comments. Also, you can find an search bar, as well as social media icons as well as tag clouds.
  • Theme It is focused on the header elements on your website such as name navigation system, the tagline and even your logo.

If you choose one of the styles in the Style Book, you have several options in the Sidebar. You can alter the default fonts for each Block, and not just for particular elements.

The Style Book showing the Typography settings panel with options for headings and paragraphs. The heading "Code Is Poetry" is displayed in various sizes, with a sample paragraph below. Font customization options are visible on the right-hand side.
There's no limit as to the ways you can modify your typography using Style Book. Style Book.

There is a way to open the identical screens when you click styles>the Blocks area on the Site Editor homepage. Whichever you decide to use the options you will have will allow you to customize the font (and even) the typeface of each Block in a stunningly precise manner.

The Site Editor offers possibilities to tune the typography of your site. The Site Editor

In every block and element you will find the same choices for the user to select from. A quick summary of each option available that is available on the Panel.

The font's design and size

It's possible that the Font drop-down menu could become confusing. Choose the font you want to use for the particular block or component:

The Style Book interface displaying a paragraph from Don Quixote and a list of characters from Alice in Wonderland. The right-hand sidebar shows typography settings, including font selection (currently set to Cardo) and various text formatting options. A quote by Julio Cortázar is featured in a blue box at the bottom.
Picking a font out of the fonts available in the Typography tab.

The sizes setting is the most flexible of configurations available in The Site Editor. Pick a size in a area that is between small and Large.

The Site Editor's Typography settings panel. The font is set to Cardo, size is set to Medium (M), and the appearance drop-down menu shows Regular selected. Line height is set to 1.55, and additional options for letter spacing and letter case are visible.
WordPress provides preset font sizes in the Editor. Editor.

If you make edits to theme.json, you are able to modify the settingsHowever, you can't use the editor to create Sites. The customizing size button allows you to define the size you'd like to use by using different sizes:

The Site Editor interface showing typography settings for a site. The main text area displays a paragraph in white on a blue background. The right-hand sidebar lets you customize font, size, appearance, and line height, with the Cardo font selected and size set to 1.2 rem.
Pick a font which is unique in addition to the device.

There's an array of methods to modify the fonts within the Editor for Sites. This includes ways that you typically utilize CSS to achieve.

Line height, appearance and the spacing between the letters

The appearance drop-down menu makes it easy to pick a typeface from the wide choice, then it will be placed in the text. Most likely, you'll have the option of using every typeface that's appropriate to the weight that you choose.

The Appearance drop-down menu within the WordPress Site Editor. The panel is set to Regular. Below it, a line height adjustment control is set to 1.55, with plus and minus buttons for fine-tuning.
The menu of appearance options can be found within The WordPress Editor. Editor.

Our tests show that WordPress does not filter this list so that it shows only the most popular available weights for the fonts. Additionally, it will apply the notion to determine the "nearest match" in the event that you select an option that does not exactly match the font. For example, we use, Cardo Normal, Cardo Bold and Cardo Bold Italic for our website demo. If you pick Semi Bold, Bold, Extra Bold and Black, it is possible to choose the sole Cardo Bold:

A GIF of the WordPress Site Editor showing a blue background with a quote from Don Quixote on the left-hand side. The right-hand sidebar shows a user cycling through options within the Appearance drop-down menu.
The font's look can be altered inside The WordPress Editor. WordPress Site Editor. WordPress Site Editor.

Line height doesn't use the presets feature, but is a balance between the font you pick for its appearance as well as the dimensions. This value places the line into a larger space and is often a viable option when there is too much text in one area.

A GIF of the WordPress Site Editor showcasing a change in the line height setting within the right-hand sidebar. The main area displays text from Don Quixote and a list of characters from Alice in Wonderland. A quote at the bottom reads, "In quoting others, we cite ourselves."
The line's height is adjustable inside the WordPress Site Editor.

The spacing between letters and spaces is identical, and is in line with the CSS practice of expanding the space naturally, as follows: following:

The Site Editor Typography sidebar showing the font set to Cardo, with options to adjust size, appearance, line height, and letter spacing. A blue background with white text showcases how the letter spacing (5 px here) appears on the website.
The letter spacing could be extended enough to render the letter difficult to understand.

Custom font sizes are available. There are many measurements. The proportional measure is the most well-known option in this case. WordPress uses spacing between letters as its CSS default that can be described as "normal." The user can select the spacing that, according to our experiences, is optimal.

The most common practice is to employ smaller positive letters spacings that are generally less than 0.12rem/em which is almost without negative space.

The last option - the lettercase allows users to select whether they want to use text lower, higher or sentence casings. Additionally, it is possible to eliminate the casing. This can help maintain the consistency of your text, since it doesn't require particular casings for creating the text.

How do you best to use theme.json to find the font that is used in your WordPress theme's typeface?

The Tool for the Site Editor tool is suitable for people with no technological skills. The theme.json file is the sole thing you'll need to ensure that it provides users with the necessary tools to modify their sites. The configuration file serves as the foundation for the development of the themes.

The content won't look at the layout or structure which are within the theme.jsonfile, but we'll look at the best method to set the fonts and styles and then apply them in.

Learn to understand the theme.json structure and define the global settings

JSON can be used to explain the components that are contained in theme.json, which includes typography. Its typography element is part of the settings component of the file. Then, you'll need to build other components, properties and objects in order to create the layout of the typography on your site.

 "version": 3, "settings": "typography": "fontFamilies": [ "fontFamily": "-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif", "slug": "system-font", "name": "System Font" ], "fontSizes": [ "slug": "small", "size": "13px", "name": "Small" , "slug": "medium", "size": "20px", "name": "Medium" ] 

The entire set of components are based on the same layout. The basic configurations (and one of the easiest to grasp) can be described as general settings. The blocks are arranged in a straightforward way, but you can set typography options that apply to particular blocks.

"styles": "blocks": "core/paragraph": "typography": "fontFamily": "var(--wp--preset--font-family--primary)", "fontSize": "var(--wp--preset--font-size--medium)", "lineHeight": "1.5" , "core/heading": "typography": "fontFamily": "var(--wp--preset--font-family--secondary)", "fontWeight": "700" 

The blocks can be used in the creation of a block property. It also creates an individual namespace for each Block you want to concentrate on. Also, it provides the two levels of nesting. It is impossible to make a mistake using this method. However, there are a variety of properties to explore.

Registration of fonts

  • fontFamily is a reference to that typeface family's font family's CSS values. This is the set of fonts you would like to integrate into your design.
  • name will be the name that appears on the Website Editor after choosing the font. It's human-readable.
  • Slug provides an independent CSS property that is able to be later used.

For the purpose of using the fonts that are available, this is easy to achieve:

... "typography": { "fontFamilies": [ "name": "Primary", "slug": "primary", "fontFamily": "Charter, 'Bitstream Charter', 'Sitka Text', Cambria, serif" , "name": "Secondary", "slug": "secondary", "fontFamily": "system-ui, sans-serif" 

To register your fonts that you've created, be sure make use of FontFace. FontFace property, based on which you will be able to specify certain attributes:

... "name": "Secondary","slug": "secondary","fontFamily": "'Open Sans', sans-serif","fontFace" (for example:"fontFace": ["fontFamily": "Open Sans""fontFace": "OpenSanss""fontWeight": "300 800","300 800", variation of the font weight. "fontStyle": "normal" The font's style should be the correct CSS font-style value. "fontStretch": "normal" In addition, it should be a valid CSS type for font stretch. "src": [ "file:./assets/fonts/open-sans.woff2" ] // This is an array of URLs for custom fonts, and can support multiple formats. , ...

After you've created your site You can then choose the Fonts fonts using the drop-down menus in the Site Editor.

A blue background with white text reading CREATE BLOCK THEME in a bold sans-serif font. The words are stacked vertically with CREATE at the top in the largest size, BLOCK slightly smaller in the middle, and THEME smallest at the bottom.
The Create Block header image used to create the theme came straight taken from WordPress.org.

It's a boilerplate you can utilize when designing themes. However, it allows you to register and define the typography as well. After you've registered the fonts you wish to utilize in a way which you feel is acceptable (we strongly recommend you make use of the Font Library), you can examine the fonts' dimensions.

The process of making the font size and type in theme.json

A further important element of typography is the determination of the size of the font. This can be achieved by using the property known as"the FontSizes property which permits users to specify specific fonts that are pre-defined to be used within the Site Editor.

"settings": "typography": "fontSizes": [ "slug": "small", "size": "12px", "name": "Small" , "slug": "x-large", "size": "32px", "name": "Extra Large" ] 

Similar to other options that deal with typography WordPress creates a unique CSS property for each preset, based on the name that you provide:

body --wp--preset--font-size--small: 12px; --wp--preset--font-size--x-large: 32px; 

WordPress blocks the fluid typography feature on default. But, it is possible to disable the feature by using the boolean value. You can set the font to an overall angle...

 "version": 2, "settings": "typography": "fluid": true 

...or according to the preset size and type that you decide to determine:

 "name": "Medium", "size": "1.25rem", "slug": "md", "fluid": "min": "1rem", "max": "1.5rem" ,

The maximum and minimum values along with maximum numbers will let you know the limits of scalability that apply to every dimension of font that you choose to create.

Utilising the newest types of fonts, as well as typography techniques.

theme.json theme.json provides many options similar to those offered by the editor for your site. It is possible to alter the fonts you use on your site by adjusting the default fonts to fit your theme:

"styles": "typography": "letterSpacing": "0.02em", "textTransform": "uppercase", "textDecoration": "underline", "lineHeight": "1.55rem", "fontStyle": "normal" 

You can choose to activate or disable these options. Each option has an binary option that permits users to change their preferences using the Site Editor and also. You have a number of modifications you are able to make in addition to the options that are provided by Site Editor.

  • customFontSize can be enabled by default. It allows users to input certain size fonts. However, it can be turned off the feature if you wish to control your options.
  • dropCap is turned off by default. If you choose to enable it, you have the option of changing drop caps back to the first alphabet in every paragraph block.
  • textColumns provides an "columns" option to every word in the Block that can be deactivated by default.
  • writingMode allows you to change the orientation of text within the Editor for Sites. The feature allows users to select either horizontal or vertical text.

The variety of theme.json means you need to start there when you are beginning your journey to develop themes. Site Editor offers a variety of options. Site Editor let you and your users modify WordPress typography.

How to best integrate typography into the design of a theme.json The study of a case

FSE allows you to create and develop with WordPress faster than it was. Additionally, the basic choice and selection of fonts are simplified. Much of that result from changes in styles regarding design. However, there are also devices that could help to make up for the absence of graphic designers who can be found.

This will begin by looking at your fonts that you use typically.

1. Mixing styles and typefaces to create a harmonious appearance.

In reality, due to the new styles, less effort is required. It's because body text is able to use typefaces which are part of the system, including the primary operating system (OS) font. What you must decide on is the font that is compatible with the OS font.

This isn't a tutorial on pairing different types. Here are a few ideas:

  • OS fonts used in body copy usually are sans-serif. That means you need to look for serif fonts or sans-serif fonts which look like an alternative but distinctive and distinct.
  • The simpler the font, simpler. maybe it is best to stay with OS font. OS font, provided it's with the overall style.
  • Try different combinations and you become familiar with the fonts that perform most effectively (and others that aren't).
The Google Fonts website displaying the Playfair Display font specimen. The sample text reads, "Whereas disregard and contempt for human rights have resulted" in various sizes. Options for specimen, type tester, glyphs, and about, and license are shown, along with a Get font button.
This is Google's Fonts page sample to be used for Playfair Display.

If you're using different versions of fonts, be aware of the dimensions they have with respect to each other and not only in relation to each other.

2. Locate the correct absolute or relative size

A font that is properly sized is crucial since the usage of incorrect absolute sizes can result in a bad experience for users. Also, this is a spot that you can choose the fonts that are default. We advise that users enjoy playing with the fonts since each pair has their individual "space" that displays the fonts.

Typescale is a fantastic tool for making the best WordPress typography, regardless of the task you want it to accomplish:

The Typescale web app interface for customizing typography. The left-hand panel shows font settings, while the right-hand side displays a preview of different heading sizes and a sample landing page design.
The Typescale website.

One of the best options is the scaling choices. The tool will use the option to pick the various sizes of fonts. The font we select is Major Third as our Major Third scale. It has an average of 1.2 and has a base dimension of 16 pixels.

A typography scale interface from Typescale, displaying various heading sizes for
There are a variety of ways to increase the size of fonts within Typeface.

On the center on the display, you'll be able to see the dimensions that have been calculated for every heading or paragraph. You can then pick from various sizes. Note that Typescale can be altered to alter the spacing between letters, line size, weight of the font, and many more. These are all adjustable within theme.json.

3. The defaults applied within theme.json

If you've found the right size and font have the right font and size, you can incorporate these into your theme.json file. This is an example of the common theme.json file will look similar to:

 "version": 3, "settings": "typography": "fontFamilies": [ "fontFamily": "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif", "slug": "ubuntu-sans", "name": "Ubuntu Sans" , "fontFamily": "\"Playfair Display\", serif", "slug": "playfair", "name": "Playfair Display" ], "fontSizes": [ "slug": "small", "size": "13px", "name": "Small" , "slug": "medium", "size": "16px", "name": "Medium" , "slug": "large", "size": "20px", "name": "Large" , "slug": "x-large", "size": "25px", "name": "Extra Large" , "slug": "huge", "size": "31px", "name": "Huge" ] , "styles": "typography": "fontFamily": "var(--wp--preset--font-family--system)", "fontSize": "var(--wp--preset--font-size--medium)", "lineHeight": "1.8" , "blocks": "core/paragraph": "typography": "fontSize": "var(--wp--preset--font-size--medium)" , "core/heading": "typography": "fontFamily": "var(--wp--preset--font-family--playfair)", "fontWeight": "700" , "core/post-title": "typography": "fontSize": "var(--wp--preset--font-size--huge)" 

It is essential to select the exact typeetters for every Block. You should also think of the best way to design each heading to be distinctively styled. It is essential to employ the same top quality WordPress typography, which can be the base of the design of the theme. This will create a uniform design across your sites. Site Editor offers users more flexibility and the option to alter the design.

The function of this plugin is an integral part of its function in the WordPress workflow to design.

An artistic illustration of the Dev logo. It depicts a person working at a computer in a dark environment. The image uses shades of blue and purple, showing hands typing on a keyboard and adjusting equipment. A monitor displays a stylized K logo.
The Dev logo.
The My interface showing a Push to Live dialog box. Options to push files and databases from staging to live environment are presented, with checkboxes for specific files, folders, and database tables.
This is only a single press.

Summary

FSE is in the process of maturing and theme.json is central for everything WordPress editing. Typography plays a significant role when it comes to this as well. WordPress offers developers the tools they need and also access to functions that need the utilization of CSS along with PHP.

Through the intuitive Site Editor interface and the ability to modify the theme.json, you can design an ideal typeface for your website. This improves its aesthetic appeal, and also matches your brand's image and improves your customer experience.

We'd love to hear your thoughts on WordPress typography, and why FSE could help you achieve success. Please share your ideas with us in the comments section below.

Jeremy Holcombe

Senior Editor at WordPress Web Developer and Content writer. Apart from everything that is related to WordPress I love playing golf, or on the beach and watching films. In addition, I'm struggling in height.

The post first appeared here. this site

This article was originally posted this site

Article was first seen on here