Show wp posts on external single page from different sites.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Show wp posts on external single page from different sites.

    i want to show posts from my sub-directory in one page with wp_quary loop.so i try this code
    PHP Code:
      <?php        require($_SERVER['DOCUMENT_ROOT'] . '/picture/wp-load.php');      $args = array(         // 'cat' => 3, // Only source posts from a specific category         'posts_per_page' => 10 // Specify how many posts you'd like to display     );     $latest_posts = new WP_Query( $args );       if ( $latest_posts->have_posts() ) {         while ( $latest_posts->have_posts() ) {             $latest_posts->the_post(); ?>                             <li>                <div class="media">                     <a class="media-left" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">                        <?php if ( has_post_thumbnail() ) { ?> <?php the_post_thumbnail(); ?> <?php ?>                     </a>                        <div class="media-body">                         <a class="catg_title" href="<?php the_permalink(); ?>"> <?php the_title(); ?></a>                    </div>                </div>            </li>         <?php }       } else {             echo '<p>There are no posts available</p>';       }       wp_reset_postdata();  ?>
    Then again in another place but same page i use same code but i want to show posts from different folder means different wp site.
    PHP Code:
      <?php        require($_SERVER['DOCUMENT_ROOT'] . '/video/wp-load.php');      $args = array(         // 'cat' => 3, // Only source posts from a specific category         'posts_per_page' => 10 // Specify how many posts you'd like to display     );     $latest_posts = new WP_Query( $args );       if ( $latest_posts->have_posts() ) {         while ( $latest_posts->have_posts() ) {             $latest_posts->the_post(); ?>                 <li>                 <div class="media">                     <a class="media-left" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">                        <?php if ( has_post_thumbnail() ) { ?> <?php the_post_thumbnail(); ?> <?php ?>                     </a>                        <div class="media-body">                         <a class="catg_title" href="<?php the_permalink(); ?>"> <?php the_title(); ?></a>                    </div>                 </div>             </li>        <?php }      } else {            echo '<p>There are no posts available</p>';      }      wp_reset_postdata();   ?>
    But problem is its showing posts from picture forlder. in this way, i use several folder but every folder show posts from 1st folder. how can i close first folder then show 2nd folder's posts?
Working...
X