php – Displaying generated HTML within a WordPress site

Question

So I already have a WordPress site, that has a theme and everything (don’t need tutorial on theme creation, it is done). It has been up for awhile. I want to integrate into it some HTML pages that a process I have generates so they can be viewed online. Now I could just dump them in a subfolder and link to them, but they would not have the look and feel of the rest of the site, or our branding, or any navigation back to the rest of the site. Not optimal.

All the files are really simple HTML, meaning they have a structure like this (there is no kind of template or fluff in the files, just the content).

<html>
<head>
    <title>...</title>
    <link />
</head>
<body>
    <h1>...</h1>
    
    ...
    
    <p>...</p>
</body>
</html>

Now I don’t want something that imports the HTML files, as there is 750+ and counting of them, which would really clutter things up, and I also just want to be able to upload and unpack a zip if there is changes to the generated files (never going to edit these pages directly through WordPress). So it is not really a one-time conversion of static HTML into WordPress but an ongoing process.

So what I figure I need to do I write some kind of plugin that intercepts the requests to the HTML pages, extracts the title, any linked stylesheets/scripts and the contents of the body tag and wraps the current theme around it. I looked for if one might exist, but nothing like this seems to. The problem for me is though I have some PHP experience, I really have no experience with WordPress plugins like this. I am looking for pointers on how to go about trying to do this. How to best approach creating a plugin like this. Can anyone with some WordPress plugin experience point me in the right direction to get me going on the code?

0
Michael Buckley 2 weeks 2023-01-17T18:26:59-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse