gpt4 book ai didi

wordpress - 评论按钮 WordPress

转载 作者:行者123 更新时间:2023-12-03 00:01:52 24 4
gpt4 key购买 nike

我正在编辑我的网站以添加评论按钮和查看评论按钮。

我调用了 PHP wordpress 函数,但不起作用。

我添加该按钮来代替 Jetpack Sharedaddy 模块。

这是代码:

$sharing_content .='<a style="margin-left:2px; font-weight:bold;" class ="comentar" href="<?php comments_link(); ?>">Add a comment</a>';

$sharing_content .='<a style="margin-left:5px; font-weight:bold;" class ="comentar" href="<?php wp_list_comments(); ?>">View comments</a>';

php模块的包含:

include_once dirname( __FILE__ ).'/sharing-sources.php';

我认为不会运行,因为我还没有添加 php wordpress 功能的包含。

有什么帮助吗? :-S

最佳答案

2 个问题 - 您的语法不正确,因为您不应该使用 PHP 开始和结束标记,您正在添加到变量 $sharing_content,因此您的语法应该是;

$sharing_content .='<a style="margin-left:2px; font-weight:bold;" class ="comentar" href="'. comments_link() .'">Add a comment</a>';

当前帖子评论的第一个链接应该有效。但是,您的第二个链接根本不起作用,您只是将 wp_list_comments(); 作为 href 值。 wp_list_comments(); 将用于在模板中显示当前帖子的所有评论,而不是链接到它们。我建议您的 href 值应该是帖子的 url,评论将在那里可见;

$sharing_content .= '<a style="margin-left:5px; font-weight:bold;" class ="comentar" href="'. the_permalink() .'">View comments</a>';

关于wordpress - 评论按钮 WordPress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12330752/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com