We are trying to add newsletter template to pages that are only have 2columns-left layout, for that we have created a custom module and added below code, but it seems it is not working. Can any one tell help us, what could be the issue.
app\code\Vendor\Module\view\frontend\layout\default.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="page.bottom.container">
<block class="Magento\Newsletter\Block\Subscribe" template="Magento_Newsletter::subscribe.phtml"/>
</referenceContainer>
</body>
</page>
Best Answer
Add a custom container within your 2columns-left.xml within your theme and assign your custom block to this new container within your theme default.xml ?
UPDATE:
Add the following to add a custom container to your layout xml
Add your .phtml to the container in your theme default.xml
If you haven't got these xml files within your theme you will need to duplicate them from the vendor folder.
Hope this helps you :)