SlideShare a Scribd company logo
1 of 29
The second part of:
HOW TO
CREATE THEME IN
MAGENTO 2 A publication of
Continuing part 1, part 2 of “How to create theme in Magento 2” will guide you
through steps by steps to configure and fundamental elements when creating theme.
Part 2
Continuing part 1, part 2 of “How to create theme in Magento 2” will guide you
through steps by steps to configure and fundamental elements when creating theme.
Part 2
See part 1 of this
tutorial here
2. Configure and
create a theme folder
- Create a theme folder in design folder as the structure below:
-app/design/<area>/<vendorName>/<newTheme>/
Example: /app/design/frontend/Magento/magestore
- Declare theme:
Create a file theme.xml in Magestore theme folder that you’ve just created and
declare information including: theme, version, parent theme (if it is a inherited
theme)
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"xsi:noNamespaceSchemaLocation="../../../../../lib/int
ernal/Magento/Framework/Config/etc/theme.xsd">
<title>Magestore Theme</title> <media>
<preview_image>media/preview.jpg</preview_image> </media>
</theme>
- Create a photo to preview for the new theme: magestore.png
We have a photo file as follows:
/app/design/frontend/Magento/magestore/media/theme/preview/magestore.png
Otherwise, there will be an error alert for not finding photos.
- Create a file composer.json in the theme folder
- In backend, go to Content > Design > Themes to see the new theme
- Configure Images (Optional)
In the file view.xml, the size of product photos in frontend will be configured.
In the new theme folder, the new folder <etc> is just created
app/design/<area>/<vendorName>/<newTheme>/etc/
- Configure Images (Optional)
In the file view.xml, the size of product photos in frontend will be configured.
In the new theme folder, the new folder <etc> is just created
app/design/<area>/<vendorName>/<newTheme>/etc/
Read this blog post with
detailed example
- Create an image folder:
+ In the theme, there are some static folders need to be added to the
image folder
+ Create folder <web> and folder <image> in the folder <web>
App/design/<area>/<vendorName>/<newTheme>web/images/
Example: /app/design/frontend/Magento/magestore/web/images/
Add a logo image to the theme:
Go to: app/design/<area>/<vendorName>/<newTheme>web/images/
Example: /app/design/frontend/Magento/magestore/web/images/
Copy the image with the name logo.png to the folder:
Example: logo.png
Magento will automatically set file logo.gif as the logo image. If you don’t want it
automatically, then create the following file:
Find and copy the file /Magento_Theme/layout/default.xml in the default theme
to the folderapp/design/<area>/<vendorName>/<newTheme>/
There will be the following path:
/app/design/frontend/Magento/magestore/Magento_Theme/layout/default.xml
Add this code to the file:
<referenceBlock name="logo"> <arguments>
<argument name="logo_file"
xsi:type="string">images/logo.png</argum
ent> </arguments> </referenceBlock>
And the result will be:
And the result will be:
- Go to Configuration then use the theme you just created:
Go to Store > Configuration > Design in Design Theme, choose the new theme:
Then Save Configuration.
So we have finished creating a new theme folder structure, the following part will
be steps to customize your own theme. Let’s move!
3. Fundamental
customization
elements
In order to customize CSS , copy files that are inherited from parent theme or
from the default theme to your theme folder.
Example: Go to theme folder /app/design/frontend/Magento/blank, copy the
folder web/css
Customize CSS:
In order to customize CSS , copy files that are inherited from parent theme or
from the default theme to your theme folder.
Example: Go to theme folder /app/design/frontend/Magento/blank, copy the
folder web/css
Customize CSS:
Paste the theme folder
Go to the folder /lib/web/css/source/lib copy the file lib.css then go to lib
folder in Magestore theme
In the folder app/design/frontend/Magento/magestore/web/css/ , open the
file style.less, then edit code as follows:
After that, create a file mytheme.less in the source folder:
We have a file path:
app/design/frontend/Magento/magestore/web/css/source/mytheme.less
Insert the following code (code in LESS language)
After deleting static folder and <var cache> folder
/pub/static/frontend/Magento/magestore
/var
Refresh your browser and we have background web color:
Customize template module:
You can also customize any module’s html, for example, if you want to customize
frontend of module Magento_Catalog, go to the
folder app/code/Magento/Catalog/view/frontend/ of the module, copy folders: layout,
templages, web to your new theme, place them in folder Magento_catalog with the same
name as the module’s name, as below:
Let me take an example of customizing a html containing the text “Buy this product now”
under the button “Add to Cart”
Go to
app/design/frontend/Magento/magestore/Magento_Catalog/templates/product/view/a
ddto.phtml:31, edit as follows:
Yay, we’re done studying!
blog.magestore.com
Thank youVisit Magestore Blog to
check the full version of
this tutorial & update
latest tutorials about
Magento 2
Magestore Blog: How to
Create theme in Magento 2

More Related Content

What's hot

Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Meet Magento Italy
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhubMagento Dev
 
Sergii Shymko: Magento 2: Composer for Extensions Distribution
Sergii Shymko: Magento 2: Composer for Extensions DistributionSergii Shymko: Magento 2: Composer for Extensions Distribution
Sergii Shymko: Magento 2: Composer for Extensions DistributionMeet Magento Italy
 
Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015
Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015
Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015Joshua Warren
 
MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2Mathew Beane
 
Magento 2 Development for PHP Developers
Magento 2 Development for PHP DevelopersMagento 2 Development for PHP Developers
Magento 2 Development for PHP DevelopersJoshua Warren
 
How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]M-Connect Media
 
Oleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performanceOleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performanceMeet Magento Italy
 
Max Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overviewMax Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overviewMeet Magento Italy
 
Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2Mathew Beane
 
Magento 2: New and Innovative? - php[world] 2015
Magento 2: New and Innovative? - php[world] 2015Magento 2: New and Innovative? - php[world] 2015
Magento 2: New and Innovative? - php[world] 2015David Alger
 
Federico Soich - Upgrading Magento Version
Federico Soich - Upgrading Magento VersionFederico Soich - Upgrading Magento Version
Federico Soich - Upgrading Magento VersionMeet Magento Italy
 
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015Joshua Warren
 
Magento 2 - Getting started.
Magento 2 - Getting started.Magento 2 - Getting started.
Magento 2 - Getting started.Aneesh Sreedharan
 
Magento 2: Modernizing an eCommerce Powerhouse
Magento 2: Modernizing an eCommerce PowerhouseMagento 2: Modernizing an eCommerce Powerhouse
Magento 2: Modernizing an eCommerce PowerhouseBen Marks
 
Magento 2 Development Best Practices
Magento 2 Development Best PracticesMagento 2 Development Best Practices
Magento 2 Development Best PracticesBen Marks
 
The journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developersThe journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developersGabriel Guarino
 
Finding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeFinding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeBen Marks
 

What's hot (20)

Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhub
 
Sergii Shymko: Magento 2: Composer for Extensions Distribution
Sergii Shymko: Magento 2: Composer for Extensions DistributionSergii Shymko: Magento 2: Composer for Extensions Distribution
Sergii Shymko: Magento 2: Composer for Extensions Distribution
 
Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015
Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015
Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015
 
MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2
 
Magento 2 Development for PHP Developers
Magento 2 Development for PHP DevelopersMagento 2 Development for PHP Developers
Magento 2 Development for PHP Developers
 
How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]
 
Introduction to Magento
Introduction to MagentoIntroduction to Magento
Introduction to Magento
 
Oleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performanceOleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performance
 
Max Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overviewMax Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overview
 
Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2
 
Magento 2: New and Innovative? - php[world] 2015
Magento 2: New and Innovative? - php[world] 2015Magento 2: New and Innovative? - php[world] 2015
Magento 2: New and Innovative? - php[world] 2015
 
Federico Soich - Upgrading Magento Version
Federico Soich - Upgrading Magento VersionFederico Soich - Upgrading Magento Version
Federico Soich - Upgrading Magento Version
 
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015
 
Magento 2 - Getting started.
Magento 2 - Getting started.Magento 2 - Getting started.
Magento 2 - Getting started.
 
Magento 2: Modernizing an eCommerce Powerhouse
Magento 2: Modernizing an eCommerce PowerhouseMagento 2: Modernizing an eCommerce Powerhouse
Magento 2: Modernizing an eCommerce Powerhouse
 
Magento 2 Development Best Practices
Magento 2 Development Best PracticesMagento 2 Development Best Practices
Magento 2 Development Best Practices
 
The journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developersThe journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developers
 
Outlook on Magento 2
Outlook on Magento 2Outlook on Magento 2
Outlook on Magento 2
 
Finding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeFinding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento Code
 

Similar to How to Create Theme in Magento 2 - Part 2: Configure and Customize Theme Elements

Designing for magento
Designing for magentoDesigning for magento
Designing for magentohainutemicute
 
How to create a simple module in Magento 2.0
How to create a simple module in Magento 2.0How to create a simple module in Magento 2.0
How to create a simple module in Magento 2.0MageWorld
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentKapil Dev Singh
 
Magento2 frontend development
Magento2   frontend developmentMagento2   frontend development
Magento2 frontend developmentKapil Dev Singh
 
14 asp.net session20
14 asp.net session2014 asp.net session20
14 asp.net session20Vivek chan
 
Getting started with Website Project and Sublime Text 2
Getting started with Website Project and Sublime Text 2Getting started with Website Project and Sublime Text 2
Getting started with Website Project and Sublime Text 2Amanda Zimmer
 
How to-create-a-simple-module-in-magento-2.0
How to-create-a-simple-module-in-magento-2.0How to-create-a-simple-module-in-magento-2.0
How to-create-a-simple-module-in-magento-2.0Daniele Crupi
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento Ravi Mehrotra
 
Easy Guide to WordPress Theme Integration
Easy Guide to WordPress Theme IntegrationEasy Guide to WordPress Theme Integration
Easy Guide to WordPress Theme IntegrationSankhala Info Solutions
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookTrọng Huỳnh
 
Child Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesChild Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesDamien Carbery
 
Best practice for magento theming by shrikant vaghela
Best practice for magento theming by shrikant vaghelaBest practice for magento theming by shrikant vaghela
Best practice for magento theming by shrikant vaghelavijaygolani
 
Joomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesJoomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesAndy Wallace
 

Similar to How to Create Theme in Magento 2 - Part 2: Configure and Customize Theme Elements (20)

Designing for magento
Designing for magentoDesigning for magento
Designing for magento
 
How to create a simple module in Magento 2.0
How to create a simple module in Magento 2.0How to create a simple module in Magento 2.0
How to create a simple module in Magento 2.0
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend Development
 
Magento2 what's new in theming
Magento2 what's new in themingMagento2 what's new in theming
Magento2 what's new in theming
 
Magento2 frontend development
Magento2   frontend developmentMagento2   frontend development
Magento2 frontend development
 
14 asp.net session20
14 asp.net session2014 asp.net session20
14 asp.net session20
 
Getting started with Website Project and Sublime Text 2
Getting started with Website Project and Sublime Text 2Getting started with Website Project and Sublime Text 2
Getting started with Website Project and Sublime Text 2
 
How to-create-a-simple-module-in-magento-2.0
How to-create-a-simple-module-in-magento-2.0How to-create-a-simple-module-in-magento-2.0
How to-create-a-simple-module-in-magento-2.0
 
Mangento
MangentoMangento
Mangento
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
 
Creating custom themes in AtoM
Creating custom themes in AtoMCreating custom themes in AtoM
Creating custom themes in AtoM
 
Easy Guide to WordPress Theme Integration
Easy Guide to WordPress Theme IntegrationEasy Guide to WordPress Theme Integration
Easy Guide to WordPress Theme Integration
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBook
 
Creating a basic joomla
Creating a basic joomlaCreating a basic joomla
Creating a basic joomla
 
Child Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesChild Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notes
 
Best practice for magento theming by shrikant vaghela
Best practice for magento theming by shrikant vaghelaBest practice for magento theming by shrikant vaghela
Best practice for magento theming by shrikant vaghela
 
skintutorial
skintutorialskintutorial
skintutorial
 
skintutorial
skintutorialskintutorial
skintutorial
 
Intro to OctoberCMS
Intro to OctoberCMSIntro to OctoberCMS
Intro to OctoberCMS
 
Joomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesJoomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic Templates
 

Recently uploaded

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Recently uploaded (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

How to Create Theme in Magento 2 - Part 2: Configure and Customize Theme Elements

  • 1. The second part of: HOW TO CREATE THEME IN MAGENTO 2 A publication of
  • 2. Continuing part 1, part 2 of “How to create theme in Magento 2” will guide you through steps by steps to configure and fundamental elements when creating theme. Part 2
  • 3. Continuing part 1, part 2 of “How to create theme in Magento 2” will guide you through steps by steps to configure and fundamental elements when creating theme. Part 2 See part 1 of this tutorial here
  • 4. 2. Configure and create a theme folder
  • 5. - Create a theme folder in design folder as the structure below: -app/design/<area>/<vendorName>/<newTheme>/ Example: /app/design/frontend/Magento/magestore - Declare theme: Create a file theme.xml in Magestore theme folder that you’ve just created and declare information including: theme, version, parent theme (if it is a inherited theme) <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance"xsi:noNamespaceSchemaLocation="../../../../../lib/int ernal/Magento/Framework/Config/etc/theme.xsd"> <title>Magestore Theme</title> <media> <preview_image>media/preview.jpg</preview_image> </media> </theme>
  • 6. - Create a photo to preview for the new theme: magestore.png We have a photo file as follows: /app/design/frontend/Magento/magestore/media/theme/preview/magestore.png Otherwise, there will be an error alert for not finding photos.
  • 7. - Create a file composer.json in the theme folder
  • 8. - In backend, go to Content > Design > Themes to see the new theme
  • 9. - Configure Images (Optional) In the file view.xml, the size of product photos in frontend will be configured. In the new theme folder, the new folder <etc> is just created app/design/<area>/<vendorName>/<newTheme>/etc/
  • 10. - Configure Images (Optional) In the file view.xml, the size of product photos in frontend will be configured. In the new theme folder, the new folder <etc> is just created app/design/<area>/<vendorName>/<newTheme>/etc/ Read this blog post with detailed example
  • 11. - Create an image folder: + In the theme, there are some static folders need to be added to the image folder + Create folder <web> and folder <image> in the folder <web> App/design/<area>/<vendorName>/<newTheme>web/images/
  • 12. Example: /app/design/frontend/Magento/magestore/web/images/ Add a logo image to the theme: Go to: app/design/<area>/<vendorName>/<newTheme>web/images/ Example: /app/design/frontend/Magento/magestore/web/images/ Copy the image with the name logo.png to the folder: Example: logo.png
  • 13. Magento will automatically set file logo.gif as the logo image. If you don’t want it automatically, then create the following file: Find and copy the file /Magento_Theme/layout/default.xml in the default theme to the folderapp/design/<area>/<vendorName>/<newTheme>/ There will be the following path: /app/design/frontend/Magento/magestore/Magento_Theme/layout/default.xml Add this code to the file: <referenceBlock name="logo"> <arguments> <argument name="logo_file" xsi:type="string">images/logo.png</argum ent> </arguments> </referenceBlock>
  • 14. And the result will be:
  • 15. And the result will be:
  • 16. - Go to Configuration then use the theme you just created: Go to Store > Configuration > Design in Design Theme, choose the new theme:
  • 17. Then Save Configuration. So we have finished creating a new theme folder structure, the following part will be steps to customize your own theme. Let’s move!
  • 19. In order to customize CSS , copy files that are inherited from parent theme or from the default theme to your theme folder. Example: Go to theme folder /app/design/frontend/Magento/blank, copy the folder web/css Customize CSS:
  • 20. In order to customize CSS , copy files that are inherited from parent theme or from the default theme to your theme folder. Example: Go to theme folder /app/design/frontend/Magento/blank, copy the folder web/css Customize CSS: Paste the theme folder
  • 21. Go to the folder /lib/web/css/source/lib copy the file lib.css then go to lib folder in Magestore theme
  • 22. In the folder app/design/frontend/Magento/magestore/web/css/ , open the file style.less, then edit code as follows:
  • 23. After that, create a file mytheme.less in the source folder: We have a file path: app/design/frontend/Magento/magestore/web/css/source/mytheme.less Insert the following code (code in LESS language)
  • 24. After deleting static folder and <var cache> folder /pub/static/frontend/Magento/magestore /var Refresh your browser and we have background web color:
  • 25. Customize template module: You can also customize any module’s html, for example, if you want to customize frontend of module Magento_Catalog, go to the folder app/code/Magento/Catalog/view/frontend/ of the module, copy folders: layout, templages, web to your new theme, place them in folder Magento_catalog with the same name as the module’s name, as below:
  • 26. Let me take an example of customizing a html containing the text “Buy this product now” under the button “Add to Cart”
  • 28. Yay, we’re done studying! blog.magestore.com
  • 29. Thank youVisit Magestore Blog to check the full version of this tutorial & update latest tutorials about Magento 2 Magestore Blog: How to Create theme in Magento 2