Calling a Custom phtml file in another phtml file, cms block, cms page, and XML layout in Magento 2

Calling a Custom phtml file in Magento 2

Calling in phtml file

<?php include ($block->getTemplateFile(‘Magento_Theme::extra/test-view.phtml’)); ?>

Calling in CMS page and block

{{block class=”Magento\Framework\View\Element\Template” name=”test_view” template=”Magento_Theme::extra/test-view.phtml”}}

Calling in XML layout

<block class=”Magento\Framework\View\Element\Template” name=”test_view” template=”Magento_Theme::extra/test-view.phtml”/>

Source:
magento.stackexchange.com/questions/212207/calling-a-custom-phtml-file-in-another-phtml-file-cms-block-cms-page-and-xml