SlideShare una empresa de Scribd logo
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/

Más contenido relacionado

Similar a 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 a 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
 

Último

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Último (20)

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 

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