On our companies website, we have a list of products, then when you click on a product, a popup opens with the product details. Because this was a popup (in a lightbox) I created a single-productpopup.php and removed the header and footer.

The problem I have now, is that the Products are showing up in the Sitemap, and therefore search engines (and this is what we want), but when the link is clicked, the single-productpopup.php is loaded, and this doesn't have a header or footer, so the visitor has no way to continue navigating around the site.

What I'm hoping is is there a way to detect if the page is being loaded in an iframe, and so do an if statement something like if page is not in iframe show header and footer

Or is there a more practical way to do this, maybe with different php files?

Edit: After thought - or add the header and footer with display: none by default, and use javascript/jquery to change that?

1 Answer 1


I solved this by adding the header php code, and the setting it with display none as below:

#main-header {

Then using JQuery I added the following:

  $( "header#main-header" ).css( "display", "inherit" );
  $( "div#mce_height" ).css( "margin-top", "100px" );

This detects if it is in an iframe, and if it's not, it will show the header

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.