【发布时间】:2017-07-25 19:58:24
【问题描述】:
我正在尝试查看我的 WordPress 主题并收到此错误:
致命错误:未捕获的错误:调用 C:\xampp\htdocs\wordpress\wp-content\themes\ChachoTheme\index.php:6 中的未定义函数 have_post() 堆栈跟踪:#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} 在 C:\xampp\htdocs 中抛出\wordpress\wp-content\themes\ChachoTheme\index.php 在第 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()。 (或者可能没有包含在上下文中。)
标签: wordpress