show wordpress post outside non wordpress php page show wordpress post outside non wordpress php page wordpress wordpress

show wordpress post outside non wordpress php page


please look into the following line in your code

require('http://test.com/wordpress/blog/wp-load.php');

in the require function you should use the relative or physical path. You should not include the url.


Since you need the wordpress database and framework this seems very unlikely to work at all. Try getting XML, RSS or JSON data from your wordpress which you can fetch with a self-made script.


For external integration, it's likely more reliable to approach this via RSS route. Simplest and possibly laziest way of making this work is by use of simplexml_load_file (and HTTP streams.)

$t = simplexml_load_file( "http://blogs.voanews.com/breaking-news/feed/" );foreach( $t->channel->item as $item ) {    printf(        "<div>%s <a href='%s'>%s</a></div><hr/>",        $item->description,        $item->link,        $item->title    );}

This outputs the feed as you'd expect to see it. Note that this doesn't use any kind of caching, so every page request hits the original feed.

<div>Some Chinese officials are furious at Apple's iPhone for apparently helping users have too much of a good time. Chinese media say the complaintssurround the iPhone's voice-activated personal assistant, known as&#8220;Siri,&#8221; which has been helping some users find prostitutes andbrothels. The Mandarin language version can apparently present users with asmany as [...] <a href='...(snip)...)'>iPhone Under Fire in China overProstitution</a></div>