Magento 2 Creating a theme

Hopefully I’m going to cover the things I’ve been unable to find out so far.

To create your own theme you need the following structure app/design/frontend/Somename/Somename1/

From here you then need Magento_Theme/layout/ and Magento_Theme/templates/ for your layout.xml files and template.phtml files

Back in app/design/frontend/Somename/Somename1/ you need a web/ folder with the following structure

css/

js/

images/

fonts/

In app/design/frontend/Somename/Somename1/ you will also need registration.php and theme.xml.

 

Your registration file should contain the following where the somename and somename1 match your folder structure

<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
‘frontend/somename/somename1’,
__DIR__
);

 

Your theme.xml file should contain the following where <parent> is if you are extending another theme

<theme xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Config/etc/theme.xsd”>
<title>A NAME</title> <!– your theme’s name –>
<parent>Magento/blank</parent> <!– the parent theme, in case your theme inherits from an existing theme –>
<media>
<preview_image>media/preview.jpg</preview_image> <!– the path to your theme’s preview image –>
</media>
</theme>

Magento | | No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

« »