• Resolved ckryanco2

    (@ckryanco2)


    We’d like to integrate non-WordPress pages with a WordPress site, so we are wondering if there is any way to export the html/css wrapper around WordPress posts from a theme in effect for the WordPress site.

    We’d like to apply that theme design to web pages on a different web server that is NOT a WordPress site, and then put links from the WordPress site there and have a consistent look and feel for this. Ideally, we’d like to be able to keep things like menus updated consistently on both the WordPress and non-WordPress pages.

    We do have access to the underlying WordPress MySQL database, and have PHP/SQL coders available to do custom work to build this — but we’re wondering if there is an existing solution to this first.

    Has anyone done this?

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator James Huff

    (@macmanx)

    No, WordPress themes only work on WordPress.

    Moderator bcworkz

    (@bcworkz)

    What James said ^^^. But you could save a WP page locally as a .html document, move it elsewhere, then replace the main content. New content will need to maintain the WP class attributes that contribute to proper styling. The result will look a lot like your WP page despite it being on a different server. However, updates to the menu or other page chrome in WP will not be applied to the remote document. If you want page styling and menus to remain in sync, you’d need a custom PHP page that fetches current menu and other data from WP. IMO, for all that effort you’re better off keeping the document within WP to start with, or importing into WP if the docs already exist.

    Thread Starter ckryanco2

    (@ckryanco2)

    Thanks. We ended up writing custom PHP code that uses cUrl to connect to a WordPress page we set up without any sidebars and save the html. Note that you need to enable CORS on the WordPress server for this (in our case, modifying the virtual host .conf file in Apache 2).

    In our testing on several WordPress themes, we found they reliably have a consistent and unique tag that marks the beginning of the content, such as “<div id=”content” class=”site-content”>”. The custom PHP code can get the top HTML from the first character of the html to that tag.

    Most of the themes also have a comment on the tag that ends the content area — such as “</div><!– #content –>”. Other themes just have the “</div>” tag with no comment, so it’s difficult to identify that point in the html — but it’s possible to use the WordPress theme file editor to add such a comment.

    We also either remove any date/time from the theme html, or dynamically update it with the current date/time.

    That approach let us save top and bottom html wrapper code that can be applied before and after the non-WordPress content we want to match the look of the WordPress site.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.