0

Unable to Get meta title on category page.

$this->getLayout()->getBlock('head')->getTitle();

Error:

Fatal error: Uncaught Error: Call to a member function getTitle() on boolean

Magento 2.3.0

3
  • in which file are you doing it ? Jan 3, 2019 at 13:31
  • Where do i have to add this? i am having the same problem on my magento 2 installation! Jan 16, 2019 at 21:21
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review Jan 16, 2019 at 21:50

1 Answer 1

0

Try using these codes:

if(Mage::registry('current_category'))
{
   echo  Mage::registry('current_category')->getMetaTitle();
}else {

 echo $this->getTitle()
 }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.