category-products
php_code
add_action( 'wp_head', function () { ?>
<script>
function inIframe() {
try {
return window.self !== window.top;
} catch (Exception) {
return true;
}
}
if (inIframe()) {
document.getElementsByTagName('html')[0].classList.add('loaded-in-iframe');
// Alternatively you could skip the CSS and just hide elements using JavaScript here!.
}
</script>
<?php } );
css-code
html.loaded-in-iframe .site-footer,
html.loaded-in-iframe .site-header,
html.loaded-in-iframe .main-navigation {
display: none!important;
}