[wp-hackers] How to load a sidebar/footer from non-WordPress environment

Andrew Nacin wp at andrewnacin.com
Fri Apr 1 07:12:02 UTC 2011


On Fri, Apr 1, 2011 at 12:57 AM, Philip Walton <philip at philipwalton.com>wrote:

> Here is my idea: create a plugin that makes an ajax request to the home
> page every time a page is saved to the database. That ajax request would
> parse the document for the footer based on a CSS/jQuery selector, perhaps
> "#footer", and then save the returned markup as a .html file on the server.
> Then, in the other application, the code could simply include that .html
> file and be fairly certain it's exactly the same as what's on the home page.
>
> It seems a little hackish, but I can't really think of a better idea.
> Anyone?


Eh, not that hackish, I've done this (or variations of this) before. On
save_post (post_type != 'revision') or publish_post or what works for you,
do a wp_remote_request() to the front page, grab the footer, and save it to
disk, or a transient, or what have you.

Nacin


More information about the wp-hackers mailing list