2

I just added one more store view in order to create set up a custom theme for a special URL. After I set everything up and view the home page, I realize that there is now a drop down that would let a user switch the view regardless of what URL I mapped to. Is there a button on the admin config to hide that drop down option or do I need to create a custom theme that override the block to hide it?

Thank you,

2
  • 2
    do you really need a new theme? There are lots of way to make changes to special pages. Hiding the block in your current theme is very easy however. Commented Sep 8, 2016 at 15:07
  • Thanks for the reply. I'm currently using Magento default theme for the primary URL. Which is why I'm wondering if there is a configuration on the UI that I can hide it. As for the custom theme, I can update the XML as needed.
    – frostshoxx
    Commented Sep 8, 2016 at 15:28

1 Answer 1

5

in your theme default xml file app/design/frontend/{vendor}/{theme_name}/Magento_Theme/layout/default.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  <body> 
      <referenceBlock name="store_language" display="false"/>
 </body>
</page>

or to completely remove block and its children use

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  <body> 
    <referenceBlock name="store_language" remove="true"/>
  </body>
</page>
4
  • 1
    ok iam sorry i do not read your question well you can disable those store views from admin stores => all stores and disable Commented Sep 8, 2016 at 15:29
  • No worry. Your answer would be my second question to disable the option on my custom theme should there be no UI available. Thanks again. Looks like there is no other way to hide that drop down except modifying the default.xml file of the select theme then?
    – frostshoxx
    Commented Sep 8, 2016 at 15:31
  • @hawk Would remove="true" not be a better choice? display="false" only stops the block from being visible, the PHP objects are still generated. remove="true" will fully remove the block and prevent it's code from being generated. See devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/… for more info
    – Ben Crook
    Commented Sep 8, 2016 at 15:37
  • in this case your remove="true" is more efficient but i used to use display="false" with block that have children so i can <move> children to else place Commented Sep 8, 2016 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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