7

I have created a new magento 2 theme by copying luma theme. The issue I have is though I have created the theme by coping luma including all directories and files including layout, css, less, js, phtml, but the theme is not a replica of luma.

Static blocks are not showing on home page (banners, products not is showing up), header, footer and styles are not showing.

I have done everything, i.e. reindex, flush cache, regenerated static content but nothing is working.

I know I can extend luma theme, but I want to create a new theme based on blank theme.

  • Have you applied your new theme under admin > Stores> Configuration > Design > Design Theme section? – Tejas Shah Jul 18 '16 at 9:21
  • @TejasShah In Magento 2.1 the configuration is moved to Content > design >configuration, and i have selected the custom theme . – Arun Karnawat Jul 18 '16 at 9:25
  • Are the store views set to all stores for these static blocks? Also there is no need to copy and paste the Luma theme, Luma extends Blank so you are already using blank. If you ONLY want to base your theme on blank then extend the blank theme. Copying and pasting themes is not best practice. – Ben Crook Jul 18 '16 at 11:44
  • @Ben-Space48 I am creating new theme based on blank theme, i have copyed and paste the luma just for testing/learning, want to create a new, just wanted to know why the style and static block not appearing on custom theme. I have updated some file in custom theme and changes are reflecting on the frondend, then why is css and Static block not loading – Arun Karnawat Jul 18 '16 at 11:56
  • If the CSS isn't loading to then I think it's a problem greater than store views. Have you cleared pub/static/frontend and var/view_preprocessed? Then generating static content? I'm not sure if running the command alone is enough. – Ben Crook Jul 18 '16 at 11:57
7

Finally I figured it out why the Static blocks are not showing on home page (banners, products not is showing up).

The reason why Static blocks are not showing is because the are used with Content > Elements > Widget. Widget are directly linked with Design Package/Theme, So when we have created a new theme the widget is not valid (or simply not linked to our custom theme), as it is still linked to Luma theme. So to show the static block on home again. Create a new Widget for our custom theme.

I Hope this Help to someone who is looking for the same.

Home Page Widget for Luma theme Magento 2

2

Luma theme is used only for demo. Part of data added by samples modules that add data to the database. So, you cannot simple replicate result just by theme.

  • 1
    sample data is installed, when i switch to luma it show the static block, but when i switch to custom theme it is not showing static block, i want to know, why static block are not showing, static block are loaded from either theme layout (xml) files or phtml files, which i have copied from luma theme, why are the static block not visible. secondly, style is loaded from stylesheet css/less which is also copied in custome theme when why are this not showing. – Arun Karnawat Jul 18 '16 at 10:19
2

You can tell your Magento Theme that it uses Luma as parent. To do so create a theme.xml-file in /app/design/frontend/{Name}/{NameSpace}/.

Content, sorta mandatory in order to let the theme work:

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
     <title>Name NameSapce</title> <!-- your theme's name -->
     <parent>Magento/luma</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>
  • This doesn't help. Widgets are still linked to the specific Luma theme and are not displayed a child theme. – Jānis Elmeris Oct 31 '17 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.