SlideShare a Scribd company logo
1 of 44
Download to read offline
Mastering in
theme.json
Tanvirul Haque
WordPress Enthusiast
www.tanvirulhaque.com
theme.json
A Configuration JSON File for
Theme Styles and Block Settings.
theme.json
File is located in the Theme’s Root Folder
theme.json
Yep! It Can be Added to Any Theme.
theme.json
The Require WordPress Version is 5.8
Until Activated the Gutenberg Plugin.
JSON stands for
JavaScript Object Notation
Basic of JSON
Basic of JSON
Objects are name-value pairs.
Basic of JSON
Basic of JSON
, { } [ ]
Data separate
by Comma
Curly Braces
hold objects
Square Brackets
hold arrays list
Basic of JSON
Basic of JSON
theme.json
Example theme.json file:
Theme.json Contains 7 Sections
1 2 3
$schema
version
settings
styles
customTemplates
templateParts
patterns
theme.json
Let’s Explore Main Two Sections
settings styles
Basic of JSON
theme.json
➔ Enables or disables features like custom font sizes, custom padding,
and colors.
➔ Defines preset values such as color palettes that generates CSS
custom properties.
Basic of JSON
"settings": { }
Contains Editor configuration.
"settings": { }
Example settings in theme.json file:
➔ An organized way to set CSS properties.
➔ Reduce the amount of CSS enqueued.
➔ Styles in the top-level will be added in the `body` selector.
Basic of JSON
"styles": { }
Applies styling to the website or the blocks.
"styles": { }
Example styles in theme.json file:
Settings and Styles
Settings - Styles -
Color
settings.color
Output:
Input:
settings.color
Output:
Input:
styles.color
Output:
Input:
Top Level vs Block Level
settings.appearanceTools: true
Enable the following UI tools:
1. Border: color, radius, style, width
2. Color: link
3. Spacing: blockGap, margin, padding
4. Typography: lineHeight
Spacing
Default Spacing
Spacing in Site Editor:
Default Spacing Preset:
styles.spacing
settings.spacing
Output:
Input:
settings.spacing
Output:
Input:
Typography
settings.fontFamilies
Output:
Input:
settings.fontFamilies
Output:
Input:
settings.fontSizes
Output:
Input:
settings.fontSizes
Output:
Input:
styles.typography
Output:
Input:
Let’s Explore Group No. One
$schema version
Basic of JSON
theme.json
Basic of JSON
"version": ?
The Current Version is v2
Basic of JSON
"version": 2
If Any Theme Used v1,
It’s Recommended to Upgrade v1 to v2
➔ Validation
➔ Inline Documentation
➔ Suggestion and Auto complete
Basic of JSON
What Does JSON Schema Help With?
How schema helps you
to write in theme.json
Why does it take so long to update the
styles in the browser?
Set WP_DEBUG or SCRIPT_DEBUG to ‘true’
in your wp-config.php
Are You Ready to Build Your Block Theme?
Let’s make it happen…
Resources might help you:
https://make.wordpress.org/core/2021/06/25/introducing-theme-json-in-wordpress-5-8/
https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/
https://developer.wordpress.org/themes/advanced-topics/theme-json/
https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-json/
https://developer.wordpress.org/block-editor/reference-guides/core-blocks/
https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-migrations/

More Related Content

Similar to Mastering in theme.json - Tanvirul Haque - WordCamp Asia 2023.pdf

CTools Style Plugins: Demo & Code Walk-Thru
CTools Style Plugins: Demo & Code Walk-ThruCTools Style Plugins: Demo & Code Walk-Thru
CTools Style Plugins: Demo & Code Walk-Thru
Amber Matz
 
9781439035665 ppt ch03
9781439035665 ppt ch039781439035665 ppt ch03
9781439035665 ppt ch03
Terry Yoast
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-Theme
Mediacurrent
 

Similar to Mastering in theme.json - Tanvirul Haque - WordCamp Asia 2023.pdf (20)

CTools Style Plugins: Demo & Code Walk-Thru
CTools Style Plugins: Demo & Code Walk-ThruCTools Style Plugins: Demo & Code Walk-Thru
CTools Style Plugins: Demo & Code Walk-Thru
 
Css
CssCss
Css
 
Css
CssCss
Css
 
Drupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechDrupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotech
 
Content style in html with example - PhpGurukul Tutorials
Content style in html with example - PhpGurukul TutorialsContent style in html with example - PhpGurukul Tutorials
Content style in html with example - PhpGurukul Tutorials
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
Getting started with css
Getting started with cssGetting started with css
Getting started with css
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
 
Css Founder.com | Cssfounder org
Css Founder.com | Cssfounder orgCss Founder.com | Cssfounder org
Css Founder.com | Cssfounder org
 
Le Wagon - Landing page
Le Wagon - Landing pageLe Wagon - Landing page
Le Wagon - Landing page
 
Chapter13_7e.ppt
Chapter13_7e.pptChapter13_7e.ppt
Chapter13_7e.ppt
 
JSON_FIles-Py (2).pptx
JSON_FIles-Py (2).pptxJSON_FIles-Py (2).pptx
JSON_FIles-Py (2).pptx
 
9781439035665 ppt ch03
9781439035665 ppt ch039781439035665 ppt ch03
9781439035665 ppt ch03
 
Unit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptUnit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.ppt
 
Kick start @ css
Kick start @ cssKick start @ css
Kick start @ css
 
TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0
 
Rational HATS and CSS
Rational HATS and CSSRational HATS and CSS
Rational HATS and CSS
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-Theme
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 

Mastering in theme.json - Tanvirul Haque - WordCamp Asia 2023.pdf