Is this possible to load the cms page/ category inside custom phtml file, if it is possible how we can load cms page/ category inside custom phtml file.



1 Answer 1


Your phtml is rendered by a block class.
You need to add this in your block class.

protected $pageFactory;
protected $brandPage;
public function __construct(
    \Magento\Cms\Model\PageFactory $pageFactory,
    $this->pageFactory = $pageFactory;

public function getBrandsPageContent()
    if (is_null($this->brandPage)) {
        $this->brandPage = $this->pageFactory->create();
        $this->brandPage->load('brand_list', 'identifier');
    return $this->brandPage->getContent();

then in your phtml you just call echo $this->getBrandsPageContent()

  • It's not very professional copy someone else answer from comment specified above as own answer Commented Jun 21, 2022 at 15:44
  • Hi @Gohil Rajesh, what is "barnd_list", "identifier" here, we dont have any identifier for the page!
    – Mani
    Commented Jun 22, 2022 at 3:47
  • @Mani every page has must be unique identifier. it means url key of your page Commented Jun 22, 2022 at 8:28
  • 1
    @VictorTihonchuk I am just trying to help here. I believe instead of adding link its better to post answer. I can clarify their doubts too Commented Jun 22, 2022 at 8:30

Your Answer

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

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