Link Category by ID

{{widget type="Magento\Catalog\Block\Category\Widget\Link" anchor_text="MY Custom category" title="Custom Category" template="category/widget/link/link_block.phtml" id_path="category/12"}}

 

there are three templates

  1. link_href.phtml
  2. link_block.phtml
  3. link_inline.phtml

the good news now is , you can use it like this in PHTML

$url =  $this->getLayout()->createBlock("Magento\Catalog\Block\Category\Widget\Link")->setIdPath("category/13")->setTemplate("category/widget/link/link_href.phtml")->toHtml();

Tags