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

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

android - Facebook Login CallbackManager FacebookCallback called onCancel() every time -