I'm using the following code to get posts from a category in a page. This category uses ACF for some fields. However, when I try to output everything, it shows everything but the_content. For better understanding, here's my code:
<div class="content ">
<?php if (have_posts()) : ?>
<h1 class="pricing">Prices</h1>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<!-- START LIST -->
<?php
global $post;
$my_query = new WP_Query('showposts=9999&category_name=my-category');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;
$category = get_the_category();
$short = get_field('short_excerpt'); // and more custom fields
?>
<!-- START PRICE CHART -->
<div class="pricechart">
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<p class="subtitle"><?php echo $short;?></p>
<div class="leftexcerpt">
<?php
if ($cap) {echo '<div class="price_row">
<div class="price_row_left">Max Guests</div>
<div class="price_row_right">'.$cap.'</div>
</div>';
} elseif ($capt) {echo '<div class="price_row">
<div class="price_row_left">Max Guests</div>
<div class="price_row_right">'.$capt.'</div>
</div>';
} else {} ?>
<!-- and some additional ACF content that displays properly -->
</div>
<!-- THE THUMB COLUMN -->
<div class="thzone">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('archi') ?></a>
</div>
</div><!-- /pricechart -->
<?php endwhile;?>
<?php endif;?>
</div><!-- /content -->
With this code, I can display everything, from title to all the posts and their ACF fields, permalinks, thumbnails, no problem at all. However, it doesn't display the main content
I assumed it had to be something really stupid, but I spent 4 hours so far and cannot figure it out so coming here as last resource. I also thought ACF could be the culprit, but it doesn't seem to be the reason since everything (included ACF) is displaying properly, however I mention this just in case it is of help. As you'll probably see, I'm not PHP savvy, just trying to learn as I go.
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
earlier but thought it was wrong and had to use only one loop. Thank you @gdaniel !wp_reset_query
should only be used if you're usingquery_posts
, which you should never use