I have a module for a blog in that I have different categories now I want print category name in phtml file through category id in magento2 I am getting category id code to display category id

$categoryIds = $_post->getCategories();

through this code blog category id is coming now i want to display title

  • which blog extension you are using? – fmsthird Apr 25 '19 at 13:41
  • can you post whole phtml code – fmsthird Apr 25 '19 at 13:48

You can try this:

$title = $_post->getParentCategories()->getTitle();  
echo $title;

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