WordPress 4.3以上版本默认开启页面的评论功能

前端之家收集整理的这篇文章主要介绍了WordPress 4.3以上版本默认开启页面的评论功能前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

使用的过程中,我们发现WordPress 4.3以及后续版本在默认情况下将页面(page)的评论功能关闭了,这意味着,你如果新建一个页面,需要手动勾选”允许评论”才可以开启页面的评论功能,这个对于那些经常要发布可以评论页面的用户来说,增加了不少工作量。如下图:

page-comment

如果你想要默认情况下开启页面评论功能,可以下载安装wordpress.org/plugins/allow-comments-on-pages-by-default/" target="_blank" rel="nofollow"> Allow Comments on Pages by Default 插件,或者切换到主题目录,将下面的代码添加主题的 functions.PHP文件中:

Crayon-5c891ce549d82716028526" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">functions.PHP
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891ce549d82716028526-1">1
Crayon-num Crayon-striped-num" data-line="Crayon-5c891ce549d82716028526-2">2
Crayon-num" data-line="Crayon-5c891ce549d82716028526-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891ce549d82716028526-4">4
Crayon-num" data-line="Crayon-5c891ce549d82716028526-5">5
Crayon-num Crayon-striped-num" data-line="Crayon-5c891ce549d82716028526-6">6
Crayon-num" data-line="Crayon-5c891ce549d82716028526-7">7
Crayon-num Crayon-striped-num" data-line="Crayon-5c891ce549d82716028526-8">8
Crayon-num" data-line="Crayon-5c891ce549d82716028526-9">9
Crayon-num Crayon-striped-num" data-line="Crayon-5c891ce549d82716028526-10">10
Crayon-num" data-line="Crayon-5c891ce549d82716028526-11">11
Crayon-num Crayon-striped-num" data-line="Crayon-5c891ce549d82716028526-12">12
Crayon-num" data-line="Crayon-5c891ce549d82716028526-13">13
Crayon-num Crayon-striped-num" data-line="Crayon-5c891ce549d82716028526-14">14
Crayon-num" data-line="Crayon-5c891ce549d82716028526-15">15
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891ce549d82716028526-1">Crayon-c">/*
Crayon-line Crayon-striped-line" id="Crayon-5c891ce549d82716028526-2">Crayon-c">Plugin Name: Allow Comments on Pages by Default
Crayon-line" id="Crayon-5c891ce549d82716028526-3">Crayon-c">Plugin URI: http://wordpress.org/plugins/allow-comments-on-pages-by-default/
Crayon-line Crayon-striped-line" id="Crayon-5c891ce549d82716028526-4">Crayon-c">Description: Turns on comments on pages in wordpress 4.3+ by default.
Crayon-line" id="Crayon-5c891ce549d82716028526-5">Crayon-c">Author: Sergey Biryukov
Crayon-line Crayon-striped-line" id="Crayon-5c891ce549d82716028526-6">Crayon-c">Author URI: http://sergeybiryukov.ru/
Crayon-line" id="Crayon-5c891ce549d82716028526-7">Crayon-c">Version: 1.0
Crayon-line Crayon-striped-line" id="Crayon-5c891ce549d82716028526-8">Crayon-c">*/
Crayon-line" id="Crayon-5c891ce549d82716028526-9">Crayon-t">functionCrayon-h"> Crayon-e">wp_open_comments_for_pagesCrayon-sy">(Crayon-h"> Crayon-sy">$Crayon-v">statusCrayon-sy">,Crayon-h"> Crayon-sy">$Crayon-v">post_typeCrayon-sy">,Crayon-h"> Crayon-sy">$Crayon-v">commentCrayon-sy">_typeCrayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line Crayon-striped-line" id="Crayon-5c891ce549d82716028526-10">Crayon-h">Crayon-st">ifCrayon-h"> Crayon-sy">(Crayon-h"> Crayon-s">'page'Crayon-h"> Crayon-o">===Crayon-h"> Crayon-sy">$Crayon-v">postCrayon-sy">_typeCrayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line" id="Crayon-5c891ce549d82716028526-11">Crayon-h">Crayon-sy">$Crayon-v">statusCrayon-h"> Crayon-o">=Crayon-h"> Crayon-s">'open'Crayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891ce549d82716028526-12">Crayon-h">Crayon-sy">}
Crayon-line" id="Crayon-5c891ce549d82716028526-13">Crayon-h">Crayon-st">returnCrayon-h"> Crayon-sy">$Crayon-v">statusCrayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891ce549d82716028526-14">Crayon-sy">}
Crayon-line" id="Crayon-5c891ce549d82716028526-15">Crayon-e">add_filterCrayon-sy">(Crayon-h"> Crayon-s">'get_default_comment_status'Crayon-sy">,Crayon-h"> Crayon-s">'wp_open_comments_for_pages'Crayon-sy">,Crayon-h"> Crayon-cn">10Crayon-sy">,Crayon-h"> Crayon-cn">3Crayon-h"> Crayon-sy">)Crayon-sy">;

原文链接:https://www.f2er.com/wordpress/238406.html

猜你在找的wordpress相关文章