Add custom copyright text below existing copyright text in Magento 2 frontend by moduleMagento 2: Changing a...

Find longest word in a string: are any of these algorithms good?

PTIJ: Should I kill my computer after installing software?

Word for a person who has no opinion about whether god exists

What are some noteworthy "mic-drop" moments in math?

In the quantum hamiltonian, why does kinetic energy turn into an operator while potential doesn't?

Why doesn't this Google Translate ad use the word "Translation" instead of "Translate"?

List elements digit difference sort

NASA's RS-25 Engines shut down time

Reversed Sudoku

Declaring and defining template, and specialising them

Are all players supposed to be able to see each others' character sheets?

How to draw cubes in a 3 dimensional plane

Are there historical instances of the capital of a colonising country being temporarily or permanently shifted to one of its colonies?

Recommendation letter by significant other if you worked with them professionally?

Are tamper resistant receptacles really safer?

Filtering SOQL results with optional conditionals

UART pins to unpowered MCU?

Is it necessary to separate DC power cables and data cables?

What's the "normal" opposite of flautando?

Conservation of Mass and Energy

If I receive an SOS signal, what is the proper response?

They call me Inspector Morse

How many characters using PHB rules does it take to be able to have access to any PHB spell at the start of an adventuring day?

Why does Captain Marvel assume the people on this planet know this?



Add custom copyright text below existing copyright text in Magento 2 frontend by module


Magento 2: Changing a Block's TemplateAdd directory structure in (frontend)moduleHow can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?How to add text block in magento 2 custom moduleAdd new action to existing module, routingMagento 2.2.5: Overriding Admin Controller sales/orderMagento Override frontend template in custom module fileMagento 2.2.5: Add, Update and Delete existing products Custom Options













0















I have attempted several steps to create a custom block to display custom copyright text below the existing default copyright in the frontend.



In my module root directory (app/code/Ciptaloka/HelloWorld/), I have these files added:





  • BlockPageFooterCopyright.php - Block file



    <?php

    namespace CiptalokaHelloWorldBlockPageFooter;

    use MagentoFrameworkViewElementTemplate;
    use MagentoFrameworkViewElementTemplateContext;

    class Copyright extends Template
    {
    public function __construct(
    Context $context,
    array $data = []
    ) {
    parent::__construct($context, $data);
    }

    public function getCopyrightTxt()
    {
    return __('All products displayed on this website are manufactured by Ciptaloka.com');
    }
    }



  • viewfrontendtemplateshtmlcopyright.phtml - Template file



    <small class="copyright">
    <span><?= $this->getCopyrightTxt(); ?></span>
    </small>



  • viewfrontendlayoutpage_footer_copyright.xml - Layout configuration file



    <?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>
    <referenceContainer name="copyright">
    <block
    name="ciptaloka_helloworld.footer.copyright"
    class="CiptalokaHelloWorldBlockPageFooterCopyright"
    after="-"
    template="html/copyright.phtml"/>
    </referenceContainer>
    </body>
    </page>



After creating those files, I tested it, but unfortunately it doesn't get displayed.



I want the frontend copyright footer to change from this:



<small class="copyright">
<span>Copyright © 2017 Magento, Inc. All rights reserved.</span>
</small>


to become this:



<small class="copyright">
<span>Copyright © 2017 Magento, Inc. All rights reserved.</span>
</small>
<small class="copyright">
<span>All products displayed on this website are manufactured by Ciptaloka.com</span>
</small>


My question is, can it be established by creating custom block on a custom module? If it can, and my codes got something wrong, can you point me out?



Thanks.





EDIT: My layout now looks like this, other files remain unchanged:



<?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>
<referenceContainer name="before.body.end">
<block
name="ciptaloka_helloworld.footer.copyright"
class="CiptalokaHelloWorldBlockPageFooterCopyright"
after="copyright"
template="html/copyright.phtml"/>
</referenceContainer>
</body>
</page>


But the result is not what I expected: my custom copyright is placed above the existing copyright message.



My custom copyright is placed above the existing copyright message










share|improve this question





























    0















    I have attempted several steps to create a custom block to display custom copyright text below the existing default copyright in the frontend.



    In my module root directory (app/code/Ciptaloka/HelloWorld/), I have these files added:





    • BlockPageFooterCopyright.php - Block file



      <?php

      namespace CiptalokaHelloWorldBlockPageFooter;

      use MagentoFrameworkViewElementTemplate;
      use MagentoFrameworkViewElementTemplateContext;

      class Copyright extends Template
      {
      public function __construct(
      Context $context,
      array $data = []
      ) {
      parent::__construct($context, $data);
      }

      public function getCopyrightTxt()
      {
      return __('All products displayed on this website are manufactured by Ciptaloka.com');
      }
      }



    • viewfrontendtemplateshtmlcopyright.phtml - Template file



      <small class="copyright">
      <span><?= $this->getCopyrightTxt(); ?></span>
      </small>



    • viewfrontendlayoutpage_footer_copyright.xml - Layout configuration file



      <?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>
      <referenceContainer name="copyright">
      <block
      name="ciptaloka_helloworld.footer.copyright"
      class="CiptalokaHelloWorldBlockPageFooterCopyright"
      after="-"
      template="html/copyright.phtml"/>
      </referenceContainer>
      </body>
      </page>



    After creating those files, I tested it, but unfortunately it doesn't get displayed.



    I want the frontend copyright footer to change from this:



    <small class="copyright">
    <span>Copyright © 2017 Magento, Inc. All rights reserved.</span>
    </small>


    to become this:



    <small class="copyright">
    <span>Copyright © 2017 Magento, Inc. All rights reserved.</span>
    </small>
    <small class="copyright">
    <span>All products displayed on this website are manufactured by Ciptaloka.com</span>
    </small>


    My question is, can it be established by creating custom block on a custom module? If it can, and my codes got something wrong, can you point me out?



    Thanks.





    EDIT: My layout now looks like this, other files remain unchanged:



    <?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>
    <referenceContainer name="before.body.end">
    <block
    name="ciptaloka_helloworld.footer.copyright"
    class="CiptalokaHelloWorldBlockPageFooterCopyright"
    after="copyright"
    template="html/copyright.phtml"/>
    </referenceContainer>
    </body>
    </page>


    But the result is not what I expected: my custom copyright is placed above the existing copyright message.



    My custom copyright is placed above the existing copyright message










    share|improve this question



























      0












      0








      0


      1






      I have attempted several steps to create a custom block to display custom copyright text below the existing default copyright in the frontend.



      In my module root directory (app/code/Ciptaloka/HelloWorld/), I have these files added:





      • BlockPageFooterCopyright.php - Block file



        <?php

        namespace CiptalokaHelloWorldBlockPageFooter;

        use MagentoFrameworkViewElementTemplate;
        use MagentoFrameworkViewElementTemplateContext;

        class Copyright extends Template
        {
        public function __construct(
        Context $context,
        array $data = []
        ) {
        parent::__construct($context, $data);
        }

        public function getCopyrightTxt()
        {
        return __('All products displayed on this website are manufactured by Ciptaloka.com');
        }
        }



      • viewfrontendtemplateshtmlcopyright.phtml - Template file



        <small class="copyright">
        <span><?= $this->getCopyrightTxt(); ?></span>
        </small>



      • viewfrontendlayoutpage_footer_copyright.xml - Layout configuration file



        <?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>
        <referenceContainer name="copyright">
        <block
        name="ciptaloka_helloworld.footer.copyright"
        class="CiptalokaHelloWorldBlockPageFooterCopyright"
        after="-"
        template="html/copyright.phtml"/>
        </referenceContainer>
        </body>
        </page>



      After creating those files, I tested it, but unfortunately it doesn't get displayed.



      I want the frontend copyright footer to change from this:



      <small class="copyright">
      <span>Copyright © 2017 Magento, Inc. All rights reserved.</span>
      </small>


      to become this:



      <small class="copyright">
      <span>Copyright © 2017 Magento, Inc. All rights reserved.</span>
      </small>
      <small class="copyright">
      <span>All products displayed on this website are manufactured by Ciptaloka.com</span>
      </small>


      My question is, can it be established by creating custom block on a custom module? If it can, and my codes got something wrong, can you point me out?



      Thanks.





      EDIT: My layout now looks like this, other files remain unchanged:



      <?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>
      <referenceContainer name="before.body.end">
      <block
      name="ciptaloka_helloworld.footer.copyright"
      class="CiptalokaHelloWorldBlockPageFooterCopyright"
      after="copyright"
      template="html/copyright.phtml"/>
      </referenceContainer>
      </body>
      </page>


      But the result is not what I expected: my custom copyright is placed above the existing copyright message.



      My custom copyright is placed above the existing copyright message










      share|improve this question
















      I have attempted several steps to create a custom block to display custom copyright text below the existing default copyright in the frontend.



      In my module root directory (app/code/Ciptaloka/HelloWorld/), I have these files added:





      • BlockPageFooterCopyright.php - Block file



        <?php

        namespace CiptalokaHelloWorldBlockPageFooter;

        use MagentoFrameworkViewElementTemplate;
        use MagentoFrameworkViewElementTemplateContext;

        class Copyright extends Template
        {
        public function __construct(
        Context $context,
        array $data = []
        ) {
        parent::__construct($context, $data);
        }

        public function getCopyrightTxt()
        {
        return __('All products displayed on this website are manufactured by Ciptaloka.com');
        }
        }



      • viewfrontendtemplateshtmlcopyright.phtml - Template file



        <small class="copyright">
        <span><?= $this->getCopyrightTxt(); ?></span>
        </small>



      • viewfrontendlayoutpage_footer_copyright.xml - Layout configuration file



        <?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>
        <referenceContainer name="copyright">
        <block
        name="ciptaloka_helloworld.footer.copyright"
        class="CiptalokaHelloWorldBlockPageFooterCopyright"
        after="-"
        template="html/copyright.phtml"/>
        </referenceContainer>
        </body>
        </page>



      After creating those files, I tested it, but unfortunately it doesn't get displayed.



      I want the frontend copyright footer to change from this:



      <small class="copyright">
      <span>Copyright © 2017 Magento, Inc. All rights reserved.</span>
      </small>


      to become this:



      <small class="copyright">
      <span>Copyright © 2017 Magento, Inc. All rights reserved.</span>
      </small>
      <small class="copyright">
      <span>All products displayed on this website are manufactured by Ciptaloka.com</span>
      </small>


      My question is, can it be established by creating custom block on a custom module? If it can, and my codes got something wrong, can you point me out?



      Thanks.





      EDIT: My layout now looks like this, other files remain unchanged:



      <?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>
      <referenceContainer name="before.body.end">
      <block
      name="ciptaloka_helloworld.footer.copyright"
      class="CiptalokaHelloWorldBlockPageFooterCopyright"
      after="copyright"
      template="html/copyright.phtml"/>
      </referenceContainer>
      </body>
      </page>


      But the result is not what I expected: my custom copyright is placed above the existing copyright message.



      My custom copyright is placed above the existing copyright message







      magento2 module blocks magento2.1.6






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 18 '17 at 1:56







      Rizki Pratama

















      asked May 16 '17 at 9:31









      Rizki PratamaRizki Pratama

      120212




      120212






















          3 Answers
          3






          active

          oldest

          votes


















          4














          Your close, the reason your template is not rendering is because you're using <referenceContainer name="copyright">. There are three issues here:




          • copyright is a block, not a container. Check vendor/magento/module-theme/view/frontend/layout/default.xml line 121. Change referenceContainer to referenceBlock.


          • If you want your change to apply on all pages you need to rename your layout XML file to be default.xml


          • Because copyright is a block you need to call your block inside it (only containers automatically render child blocks). To do this you'll need to overwrite this template - vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml so it looks like so:



           



          <small class="copyright">
          <span><?php /* @escapeNotVerified */ echo $block->getCopyright() ?></span>
          </small>

          <?php echo $this->getChildHtml('ciptaloka_helloworld.footer.copyright'); ?>


          Alternative method



          An alternative method would be to render your template via the before.body.end container (for Luma only), as this is a container it will automatically render your template.



          <referenceContainer name="before.body.end">
          <block
          name="ciptaloka_helloworld.footer.copyright"
          class="CiptalokaHelloWorldBlockPageFooterCopyright"
          after="copyright"
          template="html/copyright.phtml"/>
          </referenceContainer>





          share|improve this answer


























          • Does this mean that we cannot purely make modification from custom module codes alone and we must make changes in Magento vendor to achieve this?

            – Rizki Pratama
            May 17 '17 at 1:45











          • And I think that my custom layout configuration file (page_footer_copyright.xml) is not loaded, how to make it be loaded?

            – Rizki Pratama
            May 17 '17 at 2:08











          • Nooooo never edit files in vendor, you can create the file in your theme and it will overwrite it or if you're doing it in a module you can set the template to use your own - see this answer for how to do that. If you want your change to render on every page I think you can rename your layout XML file to be default.xml and it will render on every page. I haven't tried this before as I only work in themes not modules.

            – Ben Crook
            May 17 '17 at 6:37











          • Sorry I misunderstood that "overwrite" statement that you wrote, I get it now. I've changed referenceContainer to referenceBlock and renamed my layout file to default.xml but nothing happened. And the answer link you gave me means to change the template of block but what I want is to extend the existing copyright block with my custom block.

            – Rizki Pratama
            May 17 '17 at 7:47













          • If you want to add your template after the existing breadcrumbs without altering the existing breadcrumb template you will need to use <referenceContainer name="footer"> and add after="breadcrumbs" to your block. At the moment you have added your template but it isn't being rendered anywhere because you haven't called your template file or set the reference to a container. As footer is a container it should automatically be rendered now. Also make sure you clear cache after making XML changes.

            – Ben Crook
            May 17 '17 at 8:20



















          1














          For achieving your task you just need to create a static block for your custom HTML or text and override copyright template file in your theme



          Copy copyright.phtml file in your theme




          vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml




          to




          app/design/frontend/Vendor/theme/Magento_Theme/templates/html/copyright.phtml




          Now call your static block in copyright.phtml file to add custom text below copyright



          <?php
          /**
          * Copyright © 2016 Magento. All rights reserved.
          * See COPYING.txt for license details.
          */
          ?>
          <small class="copyright">
          <span><?php /* @escapeNotVerified */ echo $block->getCopyright() ?></span>
          </small>

          <?php echo $block->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('block_identifier')->toHtml();?>





          share|improve this answer


























          • Is there any way to achieve this without overriding the template file in Magento module vendor?

            – Rizki Pratama
            May 17 '17 at 1:50






          • 1





            @RizkiPratama You should accept an answer to help other developers to find their solutions.

            – Prince Patel
            Jun 11 '17 at 14:12



















          0














          You can change using the admin panel on this route below:



          Content > Design > Configuration > SELECT YOUR THEME > Other Settings > Footer > Copyright.



          Footer Copyright Magento 2



          So you can add your code like that and customize using the CSS below:



          <span>All products displayed on this website are manufactured by Ciptaloka.com</span>




          .copyright span{
          display:block;
          width:100%;
          margin:10px 0;
          }





          share|improve this answer
























          • As I stated in my title, I want to add it by module, NOT by admin configuration from backend page, so when user install this module, the copyright is extended by my custom copyright message.

            – Rizki Pratama
            May 18 '17 at 4:29











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f174632%2fadd-custom-copyright-text-below-existing-copyright-text-in-magento-2-frontend-by%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          Your close, the reason your template is not rendering is because you're using <referenceContainer name="copyright">. There are three issues here:




          • copyright is a block, not a container. Check vendor/magento/module-theme/view/frontend/layout/default.xml line 121. Change referenceContainer to referenceBlock.


          • If you want your change to apply on all pages you need to rename your layout XML file to be default.xml


          • Because copyright is a block you need to call your block inside it (only containers automatically render child blocks). To do this you'll need to overwrite this template - vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml so it looks like so:



           



          <small class="copyright">
          <span><?php /* @escapeNotVerified */ echo $block->getCopyright() ?></span>
          </small>

          <?php echo $this->getChildHtml('ciptaloka_helloworld.footer.copyright'); ?>


          Alternative method



          An alternative method would be to render your template via the before.body.end container (for Luma only), as this is a container it will automatically render your template.



          <referenceContainer name="before.body.end">
          <block
          name="ciptaloka_helloworld.footer.copyright"
          class="CiptalokaHelloWorldBlockPageFooterCopyright"
          after="copyright"
          template="html/copyright.phtml"/>
          </referenceContainer>





          share|improve this answer


























          • Does this mean that we cannot purely make modification from custom module codes alone and we must make changes in Magento vendor to achieve this?

            – Rizki Pratama
            May 17 '17 at 1:45











          • And I think that my custom layout configuration file (page_footer_copyright.xml) is not loaded, how to make it be loaded?

            – Rizki Pratama
            May 17 '17 at 2:08











          • Nooooo never edit files in vendor, you can create the file in your theme and it will overwrite it or if you're doing it in a module you can set the template to use your own - see this answer for how to do that. If you want your change to render on every page I think you can rename your layout XML file to be default.xml and it will render on every page. I haven't tried this before as I only work in themes not modules.

            – Ben Crook
            May 17 '17 at 6:37











          • Sorry I misunderstood that "overwrite" statement that you wrote, I get it now. I've changed referenceContainer to referenceBlock and renamed my layout file to default.xml but nothing happened. And the answer link you gave me means to change the template of block but what I want is to extend the existing copyright block with my custom block.

            – Rizki Pratama
            May 17 '17 at 7:47













          • If you want to add your template after the existing breadcrumbs without altering the existing breadcrumb template you will need to use <referenceContainer name="footer"> and add after="breadcrumbs" to your block. At the moment you have added your template but it isn't being rendered anywhere because you haven't called your template file or set the reference to a container. As footer is a container it should automatically be rendered now. Also make sure you clear cache after making XML changes.

            – Ben Crook
            May 17 '17 at 8:20
















          4














          Your close, the reason your template is not rendering is because you're using <referenceContainer name="copyright">. There are three issues here:




          • copyright is a block, not a container. Check vendor/magento/module-theme/view/frontend/layout/default.xml line 121. Change referenceContainer to referenceBlock.


          • If you want your change to apply on all pages you need to rename your layout XML file to be default.xml


          • Because copyright is a block you need to call your block inside it (only containers automatically render child blocks). To do this you'll need to overwrite this template - vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml so it looks like so:



           



          <small class="copyright">
          <span><?php /* @escapeNotVerified */ echo $block->getCopyright() ?></span>
          </small>

          <?php echo $this->getChildHtml('ciptaloka_helloworld.footer.copyright'); ?>


          Alternative method



          An alternative method would be to render your template via the before.body.end container (for Luma only), as this is a container it will automatically render your template.



          <referenceContainer name="before.body.end">
          <block
          name="ciptaloka_helloworld.footer.copyright"
          class="CiptalokaHelloWorldBlockPageFooterCopyright"
          after="copyright"
          template="html/copyright.phtml"/>
          </referenceContainer>





          share|improve this answer


























          • Does this mean that we cannot purely make modification from custom module codes alone and we must make changes in Magento vendor to achieve this?

            – Rizki Pratama
            May 17 '17 at 1:45











          • And I think that my custom layout configuration file (page_footer_copyright.xml) is not loaded, how to make it be loaded?

            – Rizki Pratama
            May 17 '17 at 2:08











          • Nooooo never edit files in vendor, you can create the file in your theme and it will overwrite it or if you're doing it in a module you can set the template to use your own - see this answer for how to do that. If you want your change to render on every page I think you can rename your layout XML file to be default.xml and it will render on every page. I haven't tried this before as I only work in themes not modules.

            – Ben Crook
            May 17 '17 at 6:37











          • Sorry I misunderstood that "overwrite" statement that you wrote, I get it now. I've changed referenceContainer to referenceBlock and renamed my layout file to default.xml but nothing happened. And the answer link you gave me means to change the template of block but what I want is to extend the existing copyright block with my custom block.

            – Rizki Pratama
            May 17 '17 at 7:47













          • If you want to add your template after the existing breadcrumbs without altering the existing breadcrumb template you will need to use <referenceContainer name="footer"> and add after="breadcrumbs" to your block. At the moment you have added your template but it isn't being rendered anywhere because you haven't called your template file or set the reference to a container. As footer is a container it should automatically be rendered now. Also make sure you clear cache after making XML changes.

            – Ben Crook
            May 17 '17 at 8:20














          4












          4








          4







          Your close, the reason your template is not rendering is because you're using <referenceContainer name="copyright">. There are three issues here:




          • copyright is a block, not a container. Check vendor/magento/module-theme/view/frontend/layout/default.xml line 121. Change referenceContainer to referenceBlock.


          • If you want your change to apply on all pages you need to rename your layout XML file to be default.xml


          • Because copyright is a block you need to call your block inside it (only containers automatically render child blocks). To do this you'll need to overwrite this template - vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml so it looks like so:



           



          <small class="copyright">
          <span><?php /* @escapeNotVerified */ echo $block->getCopyright() ?></span>
          </small>

          <?php echo $this->getChildHtml('ciptaloka_helloworld.footer.copyright'); ?>


          Alternative method



          An alternative method would be to render your template via the before.body.end container (for Luma only), as this is a container it will automatically render your template.



          <referenceContainer name="before.body.end">
          <block
          name="ciptaloka_helloworld.footer.copyright"
          class="CiptalokaHelloWorldBlockPageFooterCopyright"
          after="copyright"
          template="html/copyright.phtml"/>
          </referenceContainer>





          share|improve this answer















          Your close, the reason your template is not rendering is because you're using <referenceContainer name="copyright">. There are three issues here:




          • copyright is a block, not a container. Check vendor/magento/module-theme/view/frontend/layout/default.xml line 121. Change referenceContainer to referenceBlock.


          • If you want your change to apply on all pages you need to rename your layout XML file to be default.xml


          • Because copyright is a block you need to call your block inside it (only containers automatically render child blocks). To do this you'll need to overwrite this template - vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml so it looks like so:



           



          <small class="copyright">
          <span><?php /* @escapeNotVerified */ echo $block->getCopyright() ?></span>
          </small>

          <?php echo $this->getChildHtml('ciptaloka_helloworld.footer.copyright'); ?>


          Alternative method



          An alternative method would be to render your template via the before.body.end container (for Luma only), as this is a container it will automatically render your template.



          <referenceContainer name="before.body.end">
          <block
          name="ciptaloka_helloworld.footer.copyright"
          class="CiptalokaHelloWorldBlockPageFooterCopyright"
          after="copyright"
          template="html/copyright.phtml"/>
          </referenceContainer>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 17 '17 at 9:29

























          answered May 16 '17 at 10:01









          Ben CrookBen Crook

          9,0722477




          9,0722477













          • Does this mean that we cannot purely make modification from custom module codes alone and we must make changes in Magento vendor to achieve this?

            – Rizki Pratama
            May 17 '17 at 1:45











          • And I think that my custom layout configuration file (page_footer_copyright.xml) is not loaded, how to make it be loaded?

            – Rizki Pratama
            May 17 '17 at 2:08











          • Nooooo never edit files in vendor, you can create the file in your theme and it will overwrite it or if you're doing it in a module you can set the template to use your own - see this answer for how to do that. If you want your change to render on every page I think you can rename your layout XML file to be default.xml and it will render on every page. I haven't tried this before as I only work in themes not modules.

            – Ben Crook
            May 17 '17 at 6:37











          • Sorry I misunderstood that "overwrite" statement that you wrote, I get it now. I've changed referenceContainer to referenceBlock and renamed my layout file to default.xml but nothing happened. And the answer link you gave me means to change the template of block but what I want is to extend the existing copyright block with my custom block.

            – Rizki Pratama
            May 17 '17 at 7:47













          • If you want to add your template after the existing breadcrumbs without altering the existing breadcrumb template you will need to use <referenceContainer name="footer"> and add after="breadcrumbs" to your block. At the moment you have added your template but it isn't being rendered anywhere because you haven't called your template file or set the reference to a container. As footer is a container it should automatically be rendered now. Also make sure you clear cache after making XML changes.

            – Ben Crook
            May 17 '17 at 8:20



















          • Does this mean that we cannot purely make modification from custom module codes alone and we must make changes in Magento vendor to achieve this?

            – Rizki Pratama
            May 17 '17 at 1:45











          • And I think that my custom layout configuration file (page_footer_copyright.xml) is not loaded, how to make it be loaded?

            – Rizki Pratama
            May 17 '17 at 2:08











          • Nooooo never edit files in vendor, you can create the file in your theme and it will overwrite it or if you're doing it in a module you can set the template to use your own - see this answer for how to do that. If you want your change to render on every page I think you can rename your layout XML file to be default.xml and it will render on every page. I haven't tried this before as I only work in themes not modules.

            – Ben Crook
            May 17 '17 at 6:37











          • Sorry I misunderstood that "overwrite" statement that you wrote, I get it now. I've changed referenceContainer to referenceBlock and renamed my layout file to default.xml but nothing happened. And the answer link you gave me means to change the template of block but what I want is to extend the existing copyright block with my custom block.

            – Rizki Pratama
            May 17 '17 at 7:47













          • If you want to add your template after the existing breadcrumbs without altering the existing breadcrumb template you will need to use <referenceContainer name="footer"> and add after="breadcrumbs" to your block. At the moment you have added your template but it isn't being rendered anywhere because you haven't called your template file or set the reference to a container. As footer is a container it should automatically be rendered now. Also make sure you clear cache after making XML changes.

            – Ben Crook
            May 17 '17 at 8:20

















          Does this mean that we cannot purely make modification from custom module codes alone and we must make changes in Magento vendor to achieve this?

          – Rizki Pratama
          May 17 '17 at 1:45





          Does this mean that we cannot purely make modification from custom module codes alone and we must make changes in Magento vendor to achieve this?

          – Rizki Pratama
          May 17 '17 at 1:45













          And I think that my custom layout configuration file (page_footer_copyright.xml) is not loaded, how to make it be loaded?

          – Rizki Pratama
          May 17 '17 at 2:08





          And I think that my custom layout configuration file (page_footer_copyright.xml) is not loaded, how to make it be loaded?

          – Rizki Pratama
          May 17 '17 at 2:08













          Nooooo never edit files in vendor, you can create the file in your theme and it will overwrite it or if you're doing it in a module you can set the template to use your own - see this answer for how to do that. If you want your change to render on every page I think you can rename your layout XML file to be default.xml and it will render on every page. I haven't tried this before as I only work in themes not modules.

          – Ben Crook
          May 17 '17 at 6:37





          Nooooo never edit files in vendor, you can create the file in your theme and it will overwrite it or if you're doing it in a module you can set the template to use your own - see this answer for how to do that. If you want your change to render on every page I think you can rename your layout XML file to be default.xml and it will render on every page. I haven't tried this before as I only work in themes not modules.

          – Ben Crook
          May 17 '17 at 6:37













          Sorry I misunderstood that "overwrite" statement that you wrote, I get it now. I've changed referenceContainer to referenceBlock and renamed my layout file to default.xml but nothing happened. And the answer link you gave me means to change the template of block but what I want is to extend the existing copyright block with my custom block.

          – Rizki Pratama
          May 17 '17 at 7:47







          Sorry I misunderstood that "overwrite" statement that you wrote, I get it now. I've changed referenceContainer to referenceBlock and renamed my layout file to default.xml but nothing happened. And the answer link you gave me means to change the template of block but what I want is to extend the existing copyright block with my custom block.

          – Rizki Pratama
          May 17 '17 at 7:47















          If you want to add your template after the existing breadcrumbs without altering the existing breadcrumb template you will need to use <referenceContainer name="footer"> and add after="breadcrumbs" to your block. At the moment you have added your template but it isn't being rendered anywhere because you haven't called your template file or set the reference to a container. As footer is a container it should automatically be rendered now. Also make sure you clear cache after making XML changes.

          – Ben Crook
          May 17 '17 at 8:20





          If you want to add your template after the existing breadcrumbs without altering the existing breadcrumb template you will need to use <referenceContainer name="footer"> and add after="breadcrumbs" to your block. At the moment you have added your template but it isn't being rendered anywhere because you haven't called your template file or set the reference to a container. As footer is a container it should automatically be rendered now. Also make sure you clear cache after making XML changes.

          – Ben Crook
          May 17 '17 at 8:20













          1














          For achieving your task you just need to create a static block for your custom HTML or text and override copyright template file in your theme



          Copy copyright.phtml file in your theme




          vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml




          to




          app/design/frontend/Vendor/theme/Magento_Theme/templates/html/copyright.phtml




          Now call your static block in copyright.phtml file to add custom text below copyright



          <?php
          /**
          * Copyright © 2016 Magento. All rights reserved.
          * See COPYING.txt for license details.
          */
          ?>
          <small class="copyright">
          <span><?php /* @escapeNotVerified */ echo $block->getCopyright() ?></span>
          </small>

          <?php echo $block->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('block_identifier')->toHtml();?>





          share|improve this answer


























          • Is there any way to achieve this without overriding the template file in Magento module vendor?

            – Rizki Pratama
            May 17 '17 at 1:50






          • 1





            @RizkiPratama You should accept an answer to help other developers to find their solutions.

            – Prince Patel
            Jun 11 '17 at 14:12
















          1














          For achieving your task you just need to create a static block for your custom HTML or text and override copyright template file in your theme



          Copy copyright.phtml file in your theme




          vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml




          to




          app/design/frontend/Vendor/theme/Magento_Theme/templates/html/copyright.phtml




          Now call your static block in copyright.phtml file to add custom text below copyright



          <?php
          /**
          * Copyright © 2016 Magento. All rights reserved.
          * See COPYING.txt for license details.
          */
          ?>
          <small class="copyright">
          <span><?php /* @escapeNotVerified */ echo $block->getCopyright() ?></span>
          </small>

          <?php echo $block->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('block_identifier')->toHtml();?>





          share|improve this answer


























          • Is there any way to achieve this without overriding the template file in Magento module vendor?

            – Rizki Pratama
            May 17 '17 at 1:50






          • 1





            @RizkiPratama You should accept an answer to help other developers to find their solutions.

            – Prince Patel
            Jun 11 '17 at 14:12














          1












          1








          1







          For achieving your task you just need to create a static block for your custom HTML or text and override copyright template file in your theme



          Copy copyright.phtml file in your theme




          vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml




          to




          app/design/frontend/Vendor/theme/Magento_Theme/templates/html/copyright.phtml




          Now call your static block in copyright.phtml file to add custom text below copyright



          <?php
          /**
          * Copyright © 2016 Magento. All rights reserved.
          * See COPYING.txt for license details.
          */
          ?>
          <small class="copyright">
          <span><?php /* @escapeNotVerified */ echo $block->getCopyright() ?></span>
          </small>

          <?php echo $block->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('block_identifier')->toHtml();?>





          share|improve this answer















          For achieving your task you just need to create a static block for your custom HTML or text and override copyright template file in your theme



          Copy copyright.phtml file in your theme




          vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml




          to




          app/design/frontend/Vendor/theme/Magento_Theme/templates/html/copyright.phtml




          Now call your static block in copyright.phtml file to add custom text below copyright



          <?php
          /**
          * Copyright © 2016 Magento. All rights reserved.
          * See COPYING.txt for license details.
          */
          ?>
          <small class="copyright">
          <span><?php /* @escapeNotVerified */ echo $block->getCopyright() ?></span>
          </small>

          <?php echo $block->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('block_identifier')->toHtml();?>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 21 mins ago

























          answered May 16 '17 at 9:52









          Prince PatelPrince Patel

          14k55380




          14k55380













          • Is there any way to achieve this without overriding the template file in Magento module vendor?

            – Rizki Pratama
            May 17 '17 at 1:50






          • 1





            @RizkiPratama You should accept an answer to help other developers to find their solutions.

            – Prince Patel
            Jun 11 '17 at 14:12



















          • Is there any way to achieve this without overriding the template file in Magento module vendor?

            – Rizki Pratama
            May 17 '17 at 1:50






          • 1





            @RizkiPratama You should accept an answer to help other developers to find their solutions.

            – Prince Patel
            Jun 11 '17 at 14:12

















          Is there any way to achieve this without overriding the template file in Magento module vendor?

          – Rizki Pratama
          May 17 '17 at 1:50





          Is there any way to achieve this without overriding the template file in Magento module vendor?

          – Rizki Pratama
          May 17 '17 at 1:50




          1




          1





          @RizkiPratama You should accept an answer to help other developers to find their solutions.

          – Prince Patel
          Jun 11 '17 at 14:12





          @RizkiPratama You should accept an answer to help other developers to find their solutions.

          – Prince Patel
          Jun 11 '17 at 14:12











          0














          You can change using the admin panel on this route below:



          Content > Design > Configuration > SELECT YOUR THEME > Other Settings > Footer > Copyright.



          Footer Copyright Magento 2



          So you can add your code like that and customize using the CSS below:



          <span>All products displayed on this website are manufactured by Ciptaloka.com</span>




          .copyright span{
          display:block;
          width:100%;
          margin:10px 0;
          }





          share|improve this answer
























          • As I stated in my title, I want to add it by module, NOT by admin configuration from backend page, so when user install this module, the copyright is extended by my custom copyright message.

            – Rizki Pratama
            May 18 '17 at 4:29
















          0














          You can change using the admin panel on this route below:



          Content > Design > Configuration > SELECT YOUR THEME > Other Settings > Footer > Copyright.



          Footer Copyright Magento 2



          So you can add your code like that and customize using the CSS below:



          <span>All products displayed on this website are manufactured by Ciptaloka.com</span>




          .copyright span{
          display:block;
          width:100%;
          margin:10px 0;
          }





          share|improve this answer
























          • As I stated in my title, I want to add it by module, NOT by admin configuration from backend page, so when user install this module, the copyright is extended by my custom copyright message.

            – Rizki Pratama
            May 18 '17 at 4:29














          0












          0








          0







          You can change using the admin panel on this route below:



          Content > Design > Configuration > SELECT YOUR THEME > Other Settings > Footer > Copyright.



          Footer Copyright Magento 2



          So you can add your code like that and customize using the CSS below:



          <span>All products displayed on this website are manufactured by Ciptaloka.com</span>




          .copyright span{
          display:block;
          width:100%;
          margin:10px 0;
          }





          share|improve this answer













          You can change using the admin panel on this route below:



          Content > Design > Configuration > SELECT YOUR THEME > Other Settings > Footer > Copyright.



          Footer Copyright Magento 2



          So you can add your code like that and customize using the CSS below:



          <span>All products displayed on this website are manufactured by Ciptaloka.com</span>




          .copyright span{
          display:block;
          width:100%;
          margin:10px 0;
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 18 '17 at 2:50









          Rafael Corrêa GomesRafael Corrêa Gomes

          4,54423264




          4,54423264













          • As I stated in my title, I want to add it by module, NOT by admin configuration from backend page, so when user install this module, the copyright is extended by my custom copyright message.

            – Rizki Pratama
            May 18 '17 at 4:29



















          • As I stated in my title, I want to add it by module, NOT by admin configuration from backend page, so when user install this module, the copyright is extended by my custom copyright message.

            – Rizki Pratama
            May 18 '17 at 4:29

















          As I stated in my title, I want to add it by module, NOT by admin configuration from backend page, so when user install this module, the copyright is extended by my custom copyright message.

          – Rizki Pratama
          May 18 '17 at 4:29





          As I stated in my title, I want to add it by module, NOT by admin configuration from backend page, so when user install this module, the copyright is extended by my custom copyright message.

          – Rizki Pratama
          May 18 '17 at 4:29


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f174632%2fadd-custom-copyright-text-below-existing-copyright-text-in-magento-2-frontend-by%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...