I am using the following code to check if the current page is Product detail page:
$objectManagerCms = \Magento\Framework\App\ObjectManager::getInstance();
$registry = $objectManagerCms->get('Magento\Framework\Registry');
$currentProduct = $registry->registry('current_product');
if ($currentProduct) {
// Custom code
}
Now how to check if current page is a CMS page?