I used the following code in my page template:
<?php
while(have_posts()):the_post();
the_content();
?>
But nothing is displayed. The loop is not working. I’m sure that, there is sufficient information as content in my template page.
I used the following code in my page template:
<?php
while(have_posts()):the_post();
the_content();
?>
But nothing is displayed. The loop is not working. I’m sure that, there is sufficient information as content in my template page.
Comments are closed.
You should use if condition to check if post exists else skip the loop. Make sure to ON the error log and check the exact error.
If you save the following code as a page template and call the page template into a page by choosing it, then the page will show the page content without any hassle.
Note: it’s THE minimal bit of code.
use the following code
Try using wp_reset_query()