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 ?> </h1> <h2><?php /* @escapeNotVerified */ echo $_product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($_product); ?></h2> <?php echo $block->getChildHtml(); ?>