wordpress - have_post() does return null value in wp -
i used following code in page template:
<?php while(have_posts()):the_post(); the_content(); ?>
but nothing displayed. loop not working. i'm sure that, there sufficient information content in template page.
you should use if condition check if post exists else skip loop. make sure on error log , check exact error.
<?php wp_reset_query(); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php endwhile; else: ?> <p><?php _e('sorry, no posts matched criteria.'); ?></p> <?php endif; ?>
Comments
Post a Comment