• Hello,

    I would like to embed a couple of pages (i.e. tutorials) of my WordPress site in another site using an IFrame.
    Is there a way (maybe an attribute that I could pass in the query string of the URL) that would hide header, footer, navbar, etc, providing only the content of the page?

    Thank you in advance!
    Regards,
    Cristian.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Most times there’s nothing built in, but it’s easy to do it yourself.

    Something like this…

    <?php if (!array_key_exists ('embed', $_GET) && $_GET ['embed'] == 'yes'): ?>
      <?php get_header (); ?>
    <?php endif; ?>

    Then you can pass in a URL like this:

    https://mysite.com/my-page/?embed=yes

    Thread Starter cristian.spiescu

    (@cristianspiescu)

    Thank you catacaustic,

    I started digging based on your suggestion. Apparently every template from a theme includes get_header(), get_footer(); and besides this, themes have theme specific ways of including sidebars.

    I used a child theme. However, I did not override the template (which would have meant copying/pasting. I have inserted a JS that hides the blocks that don’t interest me.

    Best regards,
    Cristian.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Embed a WordPress in an external site (with IFrame)’ is closed to new replies.