我正在尝试为我的WordPress主题制作一个自定义评论模板。我复制了原来的评论模板,并将其放在我的主题文件夹中。然后我改变了
<?php comments_template(); ?>至
<?php comments_template( '/custom-comments.php'); ?>就像法典上说的。但是当我使用自定义注释模板时,它不会出现,代码中该行之后的所有内容都会消失。
我错过了什么吗?
我的完整代码:
<?php get_header(); ?>
<div class="col content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<p class="desc"><?php the_time('F jS, Y') ?> by <?php the_author() ?></p>
<div class="entry">
<?php the_content(); ?>
<?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
<p class="desc"><?php the_tags( 'Tags: ', ', ', ''); ?></p>
</div>
<!--<?php edit_post_link('Edit this entry','','.'); ?>-->
</div>
<?php comments_template( '/custom-comments.php'); ?>
<?php endwhile; endif; ?>
</div>
<div class="col sidebar">
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>发布于 2015-05-06 12:28:05
如果您只是复制原始注释-template.php,它包含
因此,尝试重新声明相同的php函数。
这将创建致命错误,并在包含模板时中止处理。
https://stackoverflow.com/questions/26530536
复制相似问题