Load post content into iframe

Not sure, but I think ajax solution would be more apropriate.

But anyways, if I understand this corectly, you have an archive where full posts are loaded inside iframe.

If this is a case you can modify template file (single.php) and remove header and footer

take a look at Template Hierarchy

for further reading I found this which will guide you to more advanced features:http://bavotasan.com/2009/custom-template-for-single-posts-in-wordpress/

Note: if you also want to get rid of adminbar, try this: show_admin_bar(false); at the top of your code.

Have not tested but if this does not work, you can hook inside init
and check

if(is_page()) {
    show_admin_bar(false);
}

Edit:

You can also setup a new page which will get post depending on ID.

First lets create custom-template

  • In your themes folder create file template-iframe.php (for example)
  • put this code inside

<?php
/*
* Template Name: IFrame
*/
   $id = intval($_GET["ID"]);
   $post = get_post($id);
   var_dump($post);
?>
  • Then go to dashboard and create page iframe and in the sidebar where it says: template, choose now created template (Iframe)
  • save and go to url and time http://yoururl.domain/iframe/?ID=1

it should give you back your post

Of course you need to design your own template.

Leave a Comment