Embedding an html file in a page

I generate some html locally that contains a list and gets updated fairly frequently. Iʻd like to have that file get slurped up into a WP page for display so I donʻtʻ have to keep editing a page. Right now Iʻm doing it by including the page as an object, but the WP css (1) changes the font and (2) insists on doing a scrolling overflow.

I suppose I could figure out how to change the css for both, but Iʻm wondering if I should be doing this another way. I was thinking of php, but Iʻd like to keep the regular WP page context.


EDIT: I solved this by using a WordPress Plugin, ZotPress. The page I wanted to embed was generated by Zotero and I just used the plugin to load the same entries that Zotero was exporting.

I’m not sure what you mean by object but I’ll toss out a few things I’d consider.

  • just iframe it in and set the height/width high enough to deal with the content - no font issues should occur and no programming knowledge would be required

  • write a function to use file_get_contents to get the portion of the HTML you want and write it out as content. Here you’d have to use inline styles to keep the theme font from being applied and you’d have to know some programming. You’d also probably tie it to cron job so it updates regularly.

  • depending on what control you have over where/how the HTML content is written you could write your theme/childtheme to include it via get_template_part for a custom page template or something like that- it’d be nice because no cron hassle but would require making theme modifications or creating a child theme


On the first suggestion, it’s a longish list that won’t fit in a fixed-height box and I don’t want it appearing in a box with a scroll, as it does now.

#2 sounds promising. I do want the theme fonts applied. That’s why I have a theme. :slight_smile:

There are ways to set the iframe height via javascript if you want to go that route. I think I did something like this on a previous project but it’s been a while.

This topic was automatically closed after 365 days. New replies are no longer allowed.