So, I’ve read The Loop and I got the hang of it. (I created a page that lists the 3 most recent posts, a page that shows a page (as opposed to a post), and so on.)
However, it seems silly that, in order to integrate a WordPress blog into an existing site, I’d have to replicate all the different kinds of pages (lists of posts, the posts themselves, pages, etc.)
Is there a generic way of doing this?
The full idea is something like this.
- The blog itself (with its ugly default template) is installed at http://blog.example.com.
- I want to integrate the blog into an existing site, at the URL http://example.com/blog.
- I’m doing a
mod_rewrite
that forwards the entire query string, e.g. http://blog.example.com/?p=7 gets rewritten to http://example.com/blog?p=7.
Now, in my PHP code at http://example.com/blog, I want to do something like this:
query_posts($_GET);
// display results
wp_reset_query();
That’s where I’m stuck. Basically, I want to display exactly what’s in the “content” area of a default WordPress template, on my site, according to whatever the query string dictates. Almost as if I were just using an iframe
. I would rather not have to parse the query string to figure out whether I have to loop through this or that or turn off the $more
global or not, etc.
What am I missing?
Instead, should I be installing the blog at http://example.com/blog and creating a template that mimics the website? This seemed complicated so I didn’t go this route, but maybe someone should change my mind.
Appreciate any help, including advice for alternative designs.
Have you considered outputting the blog into a full rss/ outputting the blog as json and then pulling it in that way?