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:
<?php require('site1/wp-load.php');
global $post;
$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' => 'nas_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.
require('site1/wp-load.php')
orrequire('site2/wp-load.php')
but not both in the same request