Is it bad practice to use ObjectManager in file app/design/frontend/Smartwave/porto/Magento_Catalog/templates/product/list.phtml
like this below.
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');
if($category->getDescription())
{
echo '<div style="padding: 13px;margin-top: 15px;">'.$category->getDescription().'</div>';
}
Would there be a better way to write this???
Any help would be greatly appreciated. Thank you!