我試圖讓我的WordPress主題一看,我收到此錯誤:未捕獲的錯誤:調用未定義功能have_post()
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; ?>
哪有我修復它?
問題並不在index.php文件本身,而是一個調用'the_content'內部調用一個不存在的函數'have_post()'。 (或可能未包含在上下文中。) –