phtml
Magento 2 – How to identify current page in phtml file?
Magento 2 – How to identify current page in phtml file?
$currentFullAction = $block->getRequest()->getFullActionName();
$catpages= array('catalog_category_view','catalog_product_view');
if(in_array($currentFullAction, $catpages)){
//Catalog page
}
add phtml file to Static Block or CMS Page Magenot2
you have to add this code to the block or to the page
{{block class="Magento\Framework\View\Element\Template" template="{Vendor}_{Module}::pages/example.phtml"}}
Example
{{block class="Magento\Catalog\Block\Product\ListProduct" category_id="50" name="home.products.list.custom" template="Magento_Catalog::product/list.phtml"}}