check if is_page and page template name is QQShop in wordpress
To check if the current page is a specific page template named "QQShop" in WordPress, you can use the following code:
<?php
// Check if it's a page
if (is_page()) {
// Get the current page object
$page = get_queried_object();
// Check if the page template is 'QQShop'
if ($page->template == 'QQShop.php') {
// It is the QQShop page template
echo 'This is the QQShop page template.';
} else {
// It is a different page template
echo 'This is a different page template.';
}
} else {
// It's not a page
echo 'This is not a page.';
}
?>
Make sure to replace 'QQShop.php' with the actual file name of your QQShop page template
原文地址: https://www.cveoy.top/t/topic/iCzq 著作权归作者所有。请勿转载和采集!