Display wordpress data on non-wordpress site..

I am sure many of the WordPress coders must be aware about this but this is for the ones who are new to WordPress and wish to display data from the blog on the non-wordpress based website.

I personally feel, WordPress has many hidden capabilities and this is one of them..

It’s pretty simple, all you need to do is, include wp-blog-header.php file in your page and you have all WordPress functions ready to be baked :D

include ('/path/to/wp-blog-header.php'); 

Replace /path/to/ with the actual path of your wp-blog-header.php file. You can see real life implementation on our site’s home page.

We are currently working on couple of projects for which we have used WordPress functions extensively.. and so far, the outcome is fantastic :)

3 Responses to “Display wordpress data on non-wordpress site..”

  1. Devin Walker says:

    Thanks for this, I was using this method but received a “Headers already sent” error message and have been trying to resolve it since.

    Any ideas?

  2. Deep says:

    Hi Devin,

    It shows headers already sent message when you try to print some data before passing the headers.

    These points can be the possibilities:

    1. You have left some blank line breaks before starting the php code (i.e. before < ? php)

    2. You have some HTML content being displayed before using the header function.

    Regards,
    Deep

  3. Devin Walker says:

    Ok, so it looked like the php code pulls the header info also with it and my page already had it’s own header. So you were right with #2. Instead of calling on the “wp-blog-header.php” I used “wp-config.php”… Here’s the code I have for now, I’ll be touching it up though in the future:

Leave a Reply