I am trying to make a look on my WordPress theme and I received this error:
Fatal error: Uncaught Error: Call to undefined function have_post() in C:\xampp\htdocs\wordpress\wp-content\themes\ChachoTheme\index.php:6 Stack trace: #0 C:\xampp\htdocs\wordpress\wp-includes\template-loader.php(74): include() #1 C:\xampp\htdocs\wordpress\wp-blog-header.php(19): require_once('C:\xampp\htdocs...') #2 C:\xampp\htdocs\wordpress\index.php(17): require('C:\xampp\htdocs...') #3 {main} thrown in C:\xampp\htdocs\wordpress\wp-content\themes\ChachoTheme\index.php on line 6
index.php:
<?php if (have_post() ):?>
<?php while(have_post()):the_post(); ?>
<div id="post">
<h2><a href="<?php the_permalink(); ?>"></a><?php the_title(); ?></h2>
<div class="byline">Escrito por <?php the_autor_posts_link(); ?>
el <a href="<?php the_permalink(); ?>"><?php the_time('l F d, Y'); ?></a>
</div>
<?php the_content('Read More..'); ?>
<?php endwhile; ?>
<?php else: ?>
<p>No posts were found. Sorry!")</p>
<?php endif; ?>
How can I fix it?
the_contentinternally calls a functionhave_post()which does not exist. (or might not have been included in the context.) - Sunny R Gupta