WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hello friends I am trying to get my wordpress posts to display in a non- wordpress application. Currently I am getting them by using the following method.

My wordPress page is something like this:

<div id="header">
    <!-- header content goes here -->

<div id="main-body">

    <div id="content">
        <!-- Main Body goes here -->

    <div id="sidebar">
        <!-- My Sidebar Widgets go here -->

<div id="footer"
    <!-- My footer goes here -->

and I am using:

<?php file_get_contents('http://mysite.com/blog'); ?>

It's working ok but there are 2 issues.........

  1. It is getting the entire page.

  2. My page stops loading till it fetches the wordpress data.

Hence I thought AJAX was the solution. But I don't know AJAX. hence decided to seek help here.

What I am looking for is that I just want the output content of #Content Div and #sidebar Div separately so that I can place them in my other application in two different places.

I don't even need the CSS or JS as they are common for both my themes. I just want the output and separately placed at 2 different place.

Please help.

share|improve this question
You could do a JSON request using MooTools(you mentioned using it in one of your comments).. mootools.net/docs/core/Request/Request.JSON ... not used Moo Tools myself, but the page linked provides a simple enough example(let me know if it helps). – t31os Jan 4 '11 at 16:49
up vote 2 down vote accepted

If it is all on same server it is rather easy to load WP engine and parts you need, see Integrating WordPress with Your Website.

Otherwise there is probably better to get specific data (rather than whole page) from WordPress remotely, but there are a lot of approaches to that. Also I am not aware of any off-the-shelf code that allows to do that for sidebars. For post content there is XML-RPC support and plugins for other formats (I think I read about JSON one).

share|improve this answer
Thanks that really helped. – Vikram Jan 6 '11 at 22:13

If you're using jQuery, you can request part of a page. Here's an example using this technique.

share|improve this answer
Actually I am using MooTools in my other application an I dont want to load another library like jQuery just for this purpose as it will make my application heavy – Vikram Dec 31 '10 at 9:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.