'PHP Code issue - Posts doesn't appear in Wordpress page
Can anyone please help me review the following WordPress PHP code. This suppose to show 4 media post in a page and it used to work until recently it stopped working and I can only see Title of the section and Read More link. I hope to find some help resolving the issue. Thanks.
<?php elseif( get_row_layout() == 'media_section' ):?>
<section class="beehive-in-media-section text-center">
<h2>Beehive in the Media </h2>
<div class="container-medium">
<div class="media-blocks-wrapper">
<?php
$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
// the query
$the_query = new WP_Query( array(
'posts_per_page' => 4,
'post_type' =>'media_posts',
'tax_query' => array(
array(
'taxonomy' => 'lists',
'terms' => 'featured'
)
),
));
?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="media-box-wrapper">
<div class="media-box-wrapper-inner">
<a href="<?php the_permalink(); ?>">
<span><?php the_post_thumbnail(); ?></span>
<p><?php the_title(); ?>
</p>
</a>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
</div> <!-- .media-blocks-wrapper -->
</div> <!-- container-medium -->
<a href="<?php echo get_post_type_archive_link('media_posts') ?>" class="btn btn--medium-2 btn--learnMore inline md-16 mbl-16">Read More</a>
</section>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
