WordPress获取评论列表函数:get_comments

WordPress函数get_comments用于获取整个网站或指定文章的评论列表。 get_comments( string|array $args = ” ): WP_Comment[]|int[]|int 函数参数$args数组或字符串 author_email 字符串 评论作者的邮箱地址。 author_url 字符串 评论作者的网址。 …

WordPress获取指定ID评论数据函数:get_comment

WordPress函数get_comment用于获取指定ID的评论对象数据。 get_comment( WP_Comment|string|int $comment = null, string $output = OBJECT ): WP_Comment|array|null 函数参数$comment WP_Comment|字符串|整数 评论对象或评论ID。 $output 字 …

WordPress获取已批准评论函数:get_approved_comments

WordPress函数get_approved_comments用于获取已批准的评论或已驳回的评论。 get_approved_comments( int $post_id, array $args = array() ): WP_Comment[]|int[]|int 函数参数$post_id 整数 文章ID $args数组,可用值如下 …

WordPress检测评论函数:check_comment

WordPress函数check_comment用于检测评论各字段,以判断是否为恶意评论。 check_comment( string $author, string $email, string $url, string $comment, string $user_ip, string $user_agent, string $comment_type ): bool 函数参数$author 字符串 评论作者名称 $email 字符串 评论作者 …

WordPress上一页评论函数:previous_comments_link

WordPress函数previous_comments_link显示指向上一页评论的链接。 previous_comments_link( string $label = '' ) 函数参数$label 字符串值,默认值:null 显示在链接中的文本。 函数返回值 …

WordPress当前文章评论分页函数:paginate_comments_links

WordPress函数paginate_comments_links用于输出当前文章评论分页链接。 paginate_comments_links( string|array $args = array() ) 函数参数$args数组或字符串 paginate_comments_li …

Hugo实现简单站内搜索功能

对于静态站点,搜索功能应该是一个比较棘手的问题。对于内容比较庞大的网站,可能直接跳转到第三方搜索引擎比较适合。例如使用以下搜索指令: 关键词 site:www.beizigen.com 但这种方式容易造成用户跳出网站,体验也不 …

Hugo清除hn标签中的id属性

对于长内容文章,给文章中的标题标签(h1/h2/h3等)添加id属性,在文章开头便可以添加一个锚链接导航,方便用户快速跳转到想要关注的内容片段。 Hugo会自动给hn系列标签添加id …

Hugo设置站外链接新窗口打开

Markdown语法中,超链接可以指定锚文本、链接地址和Title属性,写法如下: [锚文本](链接地址 "Title属性") 没有更多了,如果想要指定该链接在新窗口打开 …

Hugo通过Markdown渲染钩子给图片标签添加宽高属性

在使用Markdown插入图片时,标记是这样的: ![图片描述](图片URL) Hugo渲染后得到的IMG标签是这样的: <img src="图片URL" alt="图片描 …