Wordpress php和html
升华文本显示错误,当我检查web浏览器时,这行是否错误?但我看不出错误 行开始$output。='Wordpress php和html,php,html,wordpress,Php,Html,Wordpress,升华文本显示错误,当我检查web浏览器时,这行是否错误?但我看不出错误 行开始$output。=' <article class="post"> <h2><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2> <p class="post-info"><?php the_time('F j, Y G:i
<article class="post">
<h2><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2>
<p class="post-info"><?php the_time('F j, Y G:i '); ?> | by <a href="<?php echo get_author_posts_url( get_the_author_meta('ID')); ?>"><?php the_author(); ?></a>| Posted in
<?php
$categories = get_the_category( );
$separator = ", ";
$output = '';
if ($categories){
foreach ($categories as $category ) {
$output .= '<a href="' . get_the_category_link($category->term_id) . '">' . $category->cat_name . '</a>' . $separator;
}
echo trim($output, $separator);
}
?>
</p>
<?php the_content(); ?>
</article>
<?php endwhile;
else :
echo '<p>No content found</p>';
endif;
get_footer();
?>
|由|发布在
正如您所说,您将遇到以下错误
致命错误:调用未定义函数get_the_category_link()
这意味着您正在调用的函数没有定义(PHP不知道您希望它用这个函数做什么)
我认为您只是使用了错误的函数名。您想使用此“
get\u category\u link()
而不是get\u category\u link()
。Wordpress已经为您定义了get\u category\u link()
函数,因此您不应该使用此函数获得未定义的函数错误 我们应该猜出错误是什么吗?你能把错误贴出来让我们看看它是怎么说的吗?升华文本标记了“错误”$分离器;我现在不知道为什么?但在浏览器上出现了致命错误:调用未定义函数get_the_category_link()。我是个新手,但希望我能尽可能地解释清楚。感谢所有我能得到的帮助。你们所得到的错误是因为函数“getthecatgory链接”实际上不是Wordpress函数。我想你要找的可能是get\u category\u link()
。最后,问题解决了。。。。。如果我使用get_category_链接而不是。。。。获取可用的类别链接。