{"id":4700,"date":"2020-01-10T23:09:52","date_gmt":"2020-01-10T15:09:52","guid":{"rendered":"https:\/\/blog.naibabiji.com\/?p=4700"},"modified":"2020-01-10T23:09:52","modified_gmt":"2020-01-10T15:09:52","slug":"logged_in-comments","status":"publish","type":"post","link":"https:\/\/blog.naibabiji.com\/skill\/logged_in-comments.html","title":{"rendered":"\u9690\u85cfWordPress\u8bc4\u8bba\u6a21\u5757\uff0c\u53ea\u6709\u767b\u5f55\u7528\u6237\u624d\u53ef\u67e5\u770b\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\u56fd\u5185\u653f\u7b56\u539f\u56e0\uff0c\u4e2a\u4eba\u5907\u6848\u4e0d\u8ba9\u7f51\u7ad9\u5e26\u6709\u8bc4\u8bba\u529f\u80fd\uff0c\u4f46\u662f\u4e2a\u4eba\u535a\u5ba2\u4e0d\u5f00\u653e\u8bc4\u8bba\u529f\u80fd\u4f3c\u4e4e\u53c8\u6ca1\u6709\u7075\u9b42\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u8bbe\u7f6e\u6210\u53ea\u6709\u767b\u5f55\u7684\u7528\u6237\u624d\u663e\u793a\u8bc4\u8bba\u533a\u57df\u5185\u5bb9\u3002\u5177\u4f53\u7684\u65b9\u6cd5\u5982\u4e0b:<\/p>\n<p>\u627e\u5230\u4f60\u4e3b\u9898\u7684single.php\u6587\u4ef6\uff0c\u4f8b\u5982Twenty Seventeen\u4e3b\u9898\uff0c\u627e\u5230\u7c7b\u4f3c\u4e8e\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801\u3002<\/p>\n<pre>if ( comments_open() || get_comments_number() ) :\r\n\tcomments_template();\r\nendif;<\/pre>\n<p>\u4fee\u6539\u4e3a\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n<pre>if ( is_user_logged_in()){\r\n\tif ( comments_open() || get_comments_number() ) :\r\n\t\tcomments_template();\r\n\tendif;\r\n}<\/pre>\n<p>\u5176\u4ed6\u4e3b\u9898\u7684\u65b9\u6cd5\u7c7b\u4f3c\uff0c\u81ea\u5df1\u627e\u5230\u5bf9\u5e94\u7684\u4ee3\u7801\u52a0\u4e00\u4e2a\u5224\u65ad\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<pre>&lt;?php if ( is_user_logged_in()){ ?&gt;\r\n&lt;?php if ( comments_open() || get_comments_number() ) : ?&gt;\r\n\t&lt;?php comments_template( '', true ); ?&gt;\r\n&lt;?php endif; ?&gt;\r\n&lt;?php } ?&gt;<\/pre>\n<p>if\u00a0 \u00a0is_user_logged_in\u5c31\u662f\u5224\u65ad\u7528\u6237\u6709\u6ca1\u6709\u767b\u5f55\u3002\u5982\u679c\u767b\u5f55\u5c31\u663e\u793a\u8bc4\u8bba\u6a21\u5757\uff0c\u6ca1\u767b\u5f55\u5c31\u4e0d\u4f1a\u52a0\u8f7d\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u8fd9\u6837\u4fee\u6539\u540e\uff0c\u4f60\u9700\u8981\u7ed9\u7f51\u7ad9\u5f00\u653e\u6ce8\u518c\u529f\u80fd\u624d\u884c\u3002\u4f60\u53ef\u80fd\u5bf9\u4e0b\u9762\u8fd9\u51e0\u7bc7\u6587\u7ae0\u4e5f\u4f1a\u611f\u5174\u8da3\uff1a<\/p>\n<ul>\n<li><a href=\"https:\/\/blog.naibabiji.com\/files\/yao-qing-ma.html\">\u4e09\u6b3eWordPress\u9080\u8bf7\u7801\u63d2\u4ef6_\u7f51\u7ad9\u9080\u8bf7\u6ce8\u518c\u94fe\u63a5\u751f\u6210<\/a><\/li>\n<li><a href=\"https:\/\/blog.naibabiji.com\/tutorial\/ultimate-member.html\">WordPress\u4f1a\u5458\u4e2d\u5fc3\u63d2\u4ef6Ultimate Member\u4f7f\u7528\u6559\u7a0b<\/a><\/li>\n<li><a href=\"https:\/\/blog.naibabiji.com\/files\/wordpress-zhu-ce-she-zhi-mi-ma.html\">WordPress\u7f51\u7ad9\u6ce8\u518c\u65f6\u7528\u6237\u81ea\u5df1\u8bbe\u7f6e\u5bc6\u7801\u7684\u51e0\u79cd\u65b9\u6cd5<\/a><\/li>\n<li><a href=\"https:\/\/blog.naibabiji.com\/files\/wordpress-deng-lu-hou-ke-jian.html\">WordPress\u7f51\u7ad9\u9700\u8981\u6ce8\u518c\u4f1a\u5458\u5e76\u767b\u5f55\u540e\u624d\u80fd\u8bbf\u95ee\u7684\u65b9\u6cd5<\/a><\/li>\n<\/ul>\n<p>\u672c\u6587\u4ee3\u7801\u7531\u77e5\u66f4\u9e1f\u5206\u4eab\u3002<\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;4700&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;4&quot;,&quot;greet&quot;:&quot;\u7ed9\u672c\u6587\u6253\u5206 post&quot;,&quot;legend&quot;:&quot;0\\\/5 - (0 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;\u9690\u85cfWordPress\u8bc4\u8bba\u6a21\u5757\uff0c\u53ea\u6709\u767b\u5f55\u7528\u6237\u624d\u53ef\u67e5\u770b\u7684\u65b9\u6cd5&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 0px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            <span class=\"kksr-muted\">\u7ed9\u672c\u6587\u6253\u5206 post<\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u56fd\u5185\u653f\u7b56\u539f\u56e0\uff0c\u4e2a\u4eba\u5907\u6848\u4e0d\u8ba9\u7f51\u7ad9\u5e26\u6709\u8bc4\u8bba\u529f\u80fd\uff0c\u4f46\u662f\u4e2a\u4eba\u535a\u5ba2\u4e0d\u5f00\u653e\u8bc4\u8bba\u529f\u80fd\u4f3c\u4e4e\u53c8\u6ca1\u6709\u7075\u9b42\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u8bbe\u7f6e\u6210\u53ea\u6709\u767b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4701,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"\u9690\u85cfWordPress\u8bc4\u8bba\u6a21\u5757\uff0c\u53ea\u6709\u767b\u5f55\u7528\u6237\u624d\u53ef\u67e5\u770b\u7684\u65b9\u6cd5 - \u5976\u7238\u5efa\u7ad9\u7b14\u8bb0","description":"\u56fd\u5185\u653f\u7b56\u539f\u56e0\uff0c\u4e2a\u4eba\u5907\u6848\u4e0d\u8ba9\u7f51\u7ad9\u5e26\u6709\u8bc4\u8bba\u529f\u80fd\uff0c\u4f46\u662f\u4e2a\u4eba\u535a\u5ba2\u4e0d\u5f00\u653e\u8bc4\u8bba\u529f\u80fd\u4f3c\u4e4e\u53c8\u6ca1\u6709\u7075\u9b42\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u8bbe\u7f6e\u6210\u53ea\u6709\u767b\u5f55\u7684\u7528\u6237\u624d\u663e\u793a\u8bc4\u8bba\u533a\u57df\u5185\u5bb9\u3002\u5177\u4f53\u7684\u65b9\u6cd5\u5982\u4e0b: \u627e\u5230\u4f60\u4e3b\u9898\u7684single.php\u6587\u4ef6\uff0c\u4f8b\u5982Twenty Seventeen\u4e3b\u9898\uff0c\u627e\u5230\u7c7b\u4f3c\u4e8e\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801\u3002 \u4fee\u6539\u4e3a\u4e0b\u9762\u8fd9\u6837\uff1a \u5176\u4ed6\u4e3b\u9898\u7684\u65b9\u6cd5\u7c7b\u4f3c\uff0c\u81ea\u5df1\u627e\u5230\u5bf9\u5e94\u7684\u4ee3\u7801\u52a0"},"footnotes":""},"categories":[142],"tags":[],"class_list":["post-4700","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/4700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/comments?post=4700"}],"version-history":[{"count":0,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/4700\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media\/4701"}],"wp:attachment":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media?parent=4700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/categories?post=4700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/tags?post=4700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}