Discover in this tutorial how to enable new text orientations, such as vertical, in a WordPress theme using the theme.json file.
With WordPress 6.4 the option to change the text orientation to vertical was added. But by default the option is disabled.
Let’s see how you can enable it.
Instructions on how to enable text orientation in a WordPress theme
A. Add or modify the theme.json file
In case the theme does not have it, you have to create a file called theme.json and place it in the root of your theme.
Once you have done that, add the following code :
To see this and another 1097 code snippets of this website, login or subscribe here.
B. Modify the theme.json file
In case your theme already has a theme.json file you can add only this option. To do this add under “settings” the following:
To see this and another 1097 code snippets of this website, login or subscribe here.
If you already have "typography"
defined, you don’t need to add that part.
Bonus: Activate the left to right orientation
The above code will activate all the text orientation options. However, if you are developing a website where you want to enable the left to right orientation option, this would be the code you need:
To see this and another 1097 code snippets of this website, login or subscribe here.
If you want to take more advantage of the options offered by the theme.json file I recommend the tutorial where I talk about its structure and how to use it in a classic theme.
Conclusions
If you want to have the option to use vertical text orientation now you know how to get it for any WordPress theme.
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉