I have checked all of other answers that have been accepted but can't seem to get this working correctly. I have created the custom attribute and set it up to display on the frontend. It is showing up fine on the spec table tab but I am also trying to add it to right below the title.

I found the title.phtml file and tested first with a test h2 tag and after clearing cache and deleting var folder content confirmed it displays on the front end, but when I try the code the title and my h2 addition dis-appears.

I've tried reading the dev docs and am stuck at this point. I'm not a certified developer or anything clearly, so please be kind in your criticisms of my attempt. Thanks for any help in advance I truly appreciate it and will stop banging my head against my monitor if you can solve this :)

The code below is pulled from the file in vendor\your_theme\module-theme\view\frontend\templates\html\title.phtml and my addition to the code is within the h2 tag

<div class="page-title-wrapper<?php /* @escapeNotVerified */ echo $cssClass; ?>">
<h1 class="page-title"
    <?php if ($block->getId()): ?> id="<?php /* @escapeNotVerified */ echo $block->getId();?>" <?php endif; ?>
    <?php if ($block->getAddBaseAttributeAria()): ?>
        aria-labelledby="<?php /* @escapeNotVerified */ echo $block->getAddBaseAttributeAria(); ?>"
    <?php endif; ?>>
    <?php /* @escapeNotVerified */ echo $title ?>
<h2><?php /* @escapeNotVerified */ echo $_product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($_product); ?></h2>

<?php echo $block->getChildHtml(); ?>

2 Answers 2


You found the correct file which is using for Managing the Page Main title. In file templates\html\title.phtml as you can see the below function to add other child blocks using `layout.xml

getChildHtml(); ?>

To add Subtitle on Product Page add the below code catalog_product_view.xml in your current theme.

<referenceBlock name="page.main.title">
    <block class="Magento\Catalog\Block\Product\View\Description" name="product.subtitle" template="product/view/subtitle.phtml" />

Create a new file Magento_Catalog/templates/product/view/subtitle.phtml in your current theme directory and place the below code:

<h2><?php /* @escapeNotVerified */ echo $block->getProduct()->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($block->getProduct()); ?></h2>

Clear the cache and subtitle will work fine.

  • Thanks man! Super easy and it works no problem. Really appreciate it
    – gigelsmith
    Commented Sep 21, 2017 at 13:26
  • I'm facing the same problem, I tried and it display nothing. Do I have to add something additionally in the title.phtml? Thanks
    – Kᴀτᴢ
    Commented Nov 18, 2020 at 0:33

Call custom phtml file below title by xml, follow below directory to open xml file and put below code.


    <referenceBlock name="page.main.title">
        <block class="Magento\Catalog\Block\Product\View\Description" name="subtitle" template="product/view/subtitle.phtml" />

get subtitle attribute in subtitle.phtml.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');
<h1 class="page-title">
<?php echo $product->getSubTitle(); ?>

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.