Pull 2 different custom post type with 2 different wordpress into external website

I have two different WordPress pages while the main site was developed under Laravel framework. Both WordPress sub-sites have different approach for the main site. It happens that the sub-site #1 was hooked to the main site and it display properly all the blog posts/custom posts. But when I tried to hooked the sub-site #2 to the main site, it still carry the posts of sub-site #1 and/or whenever I tried to set the “post_type” => “page_customs” it don’t display the custom post I have there.

Here’s the code i have for sub-site #1:

require(‘site1/wp-load.php’);
global $post;
// $args = array( ‘posts_per_page’ => 5, ‘order’ => ‘DESC’ );
// $posts = get_posts( $args );
$sticky = get_option( ‘sticky_posts’ );
rsort( $sticky );
$sticky = array_slice( $sticky, 0, 5 );
$args = array( ‘post__in’ => $sticky, ‘ignore_sticky_posts’ => 1, ‘posts_per_page’ => 5, ‘order’ => ‘DESC’ );
$query = new WP_Query( $args );
if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();

$field = get_field_object(‘article_sticky_post’);
$value = $field[‘value’];
$choices = $field[‘choices’];

if ($value) :
foreach ( $value as $v ) :
$set = $v;
endforeach;

if($set == ‘yes’): ?>
<div class=”listed-type-item _hide”><a href=”<?php the_permalink(); ?>”><?php the_title(); ?> | <span class=”text-success small”>Read more…</span></a></div>
<?php
endif; // $set
endif; // $value
endwhile; endif; wp_reset_postdata();

While here’s the code for sub-site #2:

<?php
require(‘site2/wp-load.php’);
global $post;
$args = array( ‘post_type’ => ‘page_customs’, ‘posts_per_page’ => -1, ‘order’ => ‘DESC’ );
$query = new WP_Query( $args );
if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
?>

<div class=”listed-type-item _hide”><a href=”<?php the_permalink(); ?>”><?php the_title(); ?> | <span class=”text-success small”>Read more…</span></a></div>

<?php endwhile;
endif; wp_reset_postdata();
?>

And it happens that the sub-site #1 content (page title) loads on sub-site #2.

Read more here:: Pull 2 different custom post type with 2 different wordpress into external website

Leave a Reply

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