I have a page that works fine as a stand alone page, but as soon as I set it as my static front page, have_posts() starts returning false and the page won’t render. I’ve been going after this for a few hours now, and I’m just not sure what else to check.
I added the following code to my template before the loop and got and got the following output:
global $wp_query;
print_r($wp_query->query);
Array ( [post_type] => ajde_events [paged] => 1 [posts_per_page] => -1 [order] => asc [meta_key] => evcal_srow [orderby] => meta_value [event_type] => [event_type_2] => [event_type_3] => [event_type_4] => [event_type_5] => [_featured] => yes [meta_query] => Array ( [0] => Array ( [key] => _featured [value] => yes [compare] => = ) [1] => Array ( [key] => evcal_srow [value] => 1452125853 [compare] => >= ) ) )
Heres My loop:
<?php get_template_part(THEME_LOOP."loop-start"); ?>
<div class="ot-panel-block panel-light">
<?php get_template_part(THEME_SINGLE."page-title"); ?>
<?php get_template_part(THEME_SINGLE."image");?>
<div <?php post_class("shortcode-content"); ?>>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content();?>
<?php endwhile; else: ?>
<p><?php esc_html_e('Sorry, no posts matched your criteria.' , THEME_NAME ); ?></p>
<?php endif; ?>
</div>
</div>
<?php wp_reset_postdata(); ?>
<?php if ( comments_open() ) : ?>
<?php comments_template(); // Get comments.php template ?>
<?php endif; ?>
<?php get_template_part(THEME_LOOP."loop-end"); ?>
Edit: it’s worth noting that this used to work. it broke randomly on it’s own a few days back.
Edit 2: Sigh, I just copied and pasted the body of the page into a different page and set that page as the home page, and that page is working. I would still like to know what is going on, so that this doesn’t happen again.