简体   繁体   中英

Magento 2.2 : Override the .phtml file not reflecting

I am new to Magento2.2. I have tried to override the Magneto Blank Theme.phtml file, I have done the following.

Blank Theme File Path /Magento-Dir/vendor/magento/module-theme/view/frontend/templates/html/title.phtml

My File path app/design/frontend/MyTheme/Acorn/module-theme/template/html/title.phtml

My File

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/**
 * @var $block \Magento\Theme\Block\Html\Title
 */
$cssClass = $block->getCssClass() ? ' ' . $block->getCssClass() : '';
$title = '';
if (trim($block->getPageHeading())) {
    $title = '<span class="base" data-ui-id="page-title-wrapper" ' .  $block->getAddBaseAttribute() . '>'
        . $block->escapeHtml($block->getPageHeading()) . '</span>';
}
?>
<?php if ($title): ?> <h1>Test Text</h1>
<div class="page-title-wrapper<?= /* @escapeNotVerified */ $cssClass ?>">
    <h1 class="page-title"
        <?php if ($block->getId()): ?> id="<?= /* @escapeNotVerified */ $block->getId() ?>" <?php endif; ?>
        <?php if ($block->getAddBaseAttributeAria()): ?>
            aria-labelledby="<?= /* @escapeNotVerified */ $block->getAddBaseAttributeAria() ?>"
        <?php endif; ?>>
        <?= /* @escapeNotVerified */ $title ?>
    </h1>
    <?= $block->getChildHtml() ?>
</div>
<?php endif; ?>

After this, I had run the php bin/magento setup:static-content:deploy -f removed pub/static/frontend folder then reloaded my page. Still, it pointing the blank theme file.

I have followed the http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/templates/template-walkthrough.html

I don't the mistake i have done here, please help to find out the mistake.

Your file path is incorrect. Please override this file on the below path.

app/design/frontend/MyTheme/Acorn/Magento_Theme/template/html/title.phtml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM