[wp-hackers] Sort of virtual post_type gathering its informations from an other database

Jeremy Clarke jer at simianuprising.com
Wed Aug 22 16:19:52 UTC 2012

On Sun, Aug 19, 2012 at 6:42 AM, Lox <lox.dev at knc.nc> wrote:

> How would you suggest handling the display of such a records from an other
> database like if it was a regular post ?
If the idea is to be able to use a regular-style template with the_title()
etc. you might want to investigate something along the lines of fetching a
dummy page from the database, then using the URL to fetch the virtual post
content, and inserting the title, date, content etc. into $wp_query->posts.
As long as you got the main values that affect display, it wouldn't have to
be perfect. That way you could use a straight clone of page.php and
everything would show up properly.

It might need to be updated with future versions but probably not that much
since a lot of plugins depend on the structure that wp_query currently has
for posts.

Jeremy Clarke • jeremyclarke.org
Code and Design • globalvoicesonline.org

More information about the wp-hackers mailing list