Magento create subtopics

Source: Internet
Author: User
Tags magento2

Let our children create a theme. Let's go here for all our custom theme in magento 2:

Application/design/development/company_name/theme_name

Let us assume that our company name is the basic name of the company and our topic. We need to create the following topic directory structure:

<app>     <design>          <frontend>              <mycompany>                  <basic>                      <etc>                      <Magento_Theme>                           <layout>                                 default.xml                      <media>                           preview.png                      <web>                           <css>                           <fonts>                           <images>                           <js>                  theme.xml                  registration.php

My company :-

Name of the topic package

The name of the <strong> basic </strong> topic. We can have multiple named themes in my folder.

View. xml :-

This file is used to specify the image size and thumbnails of the product.

<Strong> magento_theme: </strong> This directory is used to overwrite existing magento topic files.

Magento_theme/layout/Default. xml :-By default, magento2 assumes that your theme logo file should be:/Network/Media/PlatformIf you need some other files as the flag, then you must declare itdefault.xmlFile

This file is also used to override the settings of the default topic.

<Strong> media/preview.png: </strong>-preview the current topic.

<Strong> network: </strong> the directory contains static data of all themes, such as, style, JavaScript, and font.

<Strong> Registration. php: </strong> This file needs to register our topic magento2 system.

<Strong> theme. xml: </strong>-this is a mandatory file that defines our topic name, its mother, And the preview image of the optional topic.

Create a topic File

Let us create our files one by one.

Theme. XML (Application/design/development/Company/basic/theme. XML)

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">   <title>Basic</title> <!-- your theme‘s name -->   <parent>Magento/blank</parent> <!-- the parent theme -->   <media>        <preview_image>media/preview.jpg</preview_image> <!-- theme‘s preview image -->   </media></theme>

Registration. php (Application/design/development/Company/basic/registration. php)


<?php\Magento\Framework\Component\ComponentRegistrar::register(    \Magento\Framework\Component\ComponentRegistrar::THEME,    ‘frontend/mycompany/basic‘,    __DIR__);

Default. XML (Application/design/development/Company/basic/magento_theme/layout/Default. XML)


<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">    <body>        <referenceBlock name="logo">           <arguments>              <argument name="logo_file" xsi:type="string">images/my_logo.png</argument>              <argument name="logo_img_width" xsi:type="number">200</argument>              <argument name="logo_img_height" xsi:type="number">200</argument>           </arguments>        </referenceBlock>    </body></page>

At this point, our topic is preparation. Clear cache, We will select a new topic from the management.

Now, log on and move to the Admin directory in the following path:

Content-> Design-> topic

You should see your topic go public.

Go now:

Store-> Configuration-> Design

Select the main website in front of the store in the upper-left corner. Click now

Design-> Design Subject

Deselect the default check box and select your topic. Click Save configuration to clear your cache and prepare your new topic. Check your homepage.


Magento create subtopics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.