I’ve made some researches on google but can’t get the right answer.
I need to get my wordpress loops outside a domain using php file.
For example: I have a website hosted with www.mysite.com using wordpress. And an other one is www.secondwebsite.com using only php.
I would love to use something like the wp-load.php to use my loops in my php files.
Thanks a lot,
jhon
I can’t get the server path rightly… Any ideas?
Here are my different path:
PHP FILE THAT NEED TO LOAD wp-load.php:
/home/faver/domains/facebook.faver.be/www/lili
Folder where the wp-load.php is:
/home/lbpl/www/
I tried this:
<?php
//Include WordPress
define('WP_USE_THEMES', false);
require('../../../../../lbpl/www/wp-load.php');
query_posts('showposts=1');
?>
<?php while (have_posts()):
the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<p><a href="<?php the_permalink(); ?>">Read more...</a></p>
<?php endwhile; ?>
But not working. I think I can’t go to the /home
directory cuz of the FTP rights.
Thanks for the help
Jhon
You mean:
<?php
include "http://www.sample.com/wp-load.php";
This setting is disabled/not allowed by default in most web servers (php.ini) so you can not use the include to include the files from a remote address for security reasons.
If you still want to allow inclusion of remote files, the directive
allow_url_include must be set to
On(or 1) in
php.ini`.But again it is a bad practice, in a security-oriented point of view. Often it is generally disabled.
Alternative is to use the feed. Parse the feed of the WordPress installation and use the content from this part. A another alternative is the XMLRPC surface, but the feed is easy to use and have all content parts.
Another option is to use wordpress json api. As bueltge mentioned the rss feed is one way to get your content but json api couldbe better in this case 🙂
Option one is to use http://wordpress.org/plugins/json-api/ option two would be the jetpack json api.