Load Posts on external page

This Topic Look similar to others but i assure you,its totally unique problem.i have a custom homepage on main domain. then i install wp on browse folder and enable multi-site.so i create another 4 sites from wp network.now i want to show recent 10 post from every site on different places on same page. so i use to load wp main file and call 10 post like this.

    <?php
define('WP_USE_THEMES', true);
require ('browse/wp-load.php');
global $post;
$args = array( 'posts_per_page' => 10, 'offset'=> 1, 'category' => 1 );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : 
  setup_postdata( $post ); ?>
<li><div class="media"> <a class="media-left" href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?> </a>
<div class="media-body"> <a class="catg_title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div></div></li>
<?php endforeach;
wp_reset_postdata(); ?>

But i see DATABASE ERROR. why? and how i can specify a blog from 4 blogs of multisite-network.

Read more here: Load Posts on external page

Leave a Reply

Your email address will not be published. Required fields are marked *