{"id":4457,"date":"2019-01-08T10:31:16","date_gmt":"2019-01-08T02:31:16","guid":{"rendered":"https:\/\/www.npc.ink\/4457.html"},"modified":"2019-03-15T11:31:03","modified_gmt":"2019-03-15T03:31:03","slug":"%e7%ae%a1%e7%90%86%e5%91%98%e7%99%bb%e9%99%86%e6%98%be%e7%a4%ba%e7%bc%96%e8%be%91%e6%96%87%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/www.npc.ink\/4457.html","title":{"rendered":"\u524d\u53f0\u663e\u793a\u7f16\u8f91\u94fe\u63a5-WordPress\u4e3b\u9898\u5f00\u53d1"},"content":{"rendered":"

edit_post_link\uff1a<\/strong><\/h2>\n

\u663e\u793a\u53d1\u5e03\u7684\u7f16\u8f91\u5e16\u5b50\u94fe\u63a5\u3002<\/span><\/p>\n

https:\/\/developer.wordpress.org\/reference\/functions\/edit_post_link\/<\/p><\/blockquote>\n

get_edit_post_link:<\/strong><\/p>\n

\u68c0\u7d22\u53d1\u5e03\u7684\u7f16\u8f91\u5e16\u5b50\u94fe\u63a5\u3002<\/span><\/p>\n

https:\/\/developer.wordpress.org\/reference\/functions\/get_edit_post_link\/<\/p><\/blockquote>\n

\u6dfb\u52a0\u4e8e\u535a\u6587\u5faa\u73af\u51fd\u6570\u5185<\/span><\/h2>\n

\u628a\u5b83\u653e\u5728\u4f60\u8f93\u51fathe_content\uff08\uff09\u9644\u8fd1\u7684\u4e3b\u9898\u6587\u4ef6\u4e2d\uff08\u53ef\u80fd\u5728single.php\u6216page.php\u6587\u4ef6\u4e2d\uff09\uff0c\u4ee5\u521b\u5efa\u4e00\u4e2a\u94fe\u63a5\uff0c\u4f60\u53ef\u4ee5\u70b9\u51fb\u5b83\u8fdb\u5165\u7ba1\u7406\u5458\u8fdb\u884c\u7f16\u8f91\u3002\u6b64\u94fe\u63a5\u4ec5\u5728\u67e5\u770b\u8005\u767b\u5f55\u5e76\u4e14\u5177\u6709\u7f16\u8f91\u8be5\u9875\u9762\uff08\u7ba1\u7406\u5458\u6216\u4f5c\u8005\uff09\u7684\u9002\u5f53\u6743\u9650\u65f6\u624d\u53ef\u89c1\u3002<\/p>\n

<?php<\/span> edit_post_link(__('Edit This'<\/span>)); ?><\/span>\n<\/pre>\n

 \u6709\u7f16\u8f91\u6743\u9650\u7684\u4eba(\u8d85\u7ea7\u7ba1\u7406\u5458\uff0c\u7ba1\u7406\u5458\uff0c\u7f16\u8f91\uff0c\u4f5c\u8005)\uff0c\u663e\u793a\u7f16\u8f91\u6309\u94ae\uff1a\uff08\u63a8\u8350\uff0c\u6765\u6e90\u4e8e\u5b98\u65b92019\u4e3b\u9898\uff09<\/strong><\/p>\n

wp-content\\themes\\twentynineteen\\template-parts\\content\\content-page.php<\/span><\/p><\/blockquote>\n

\u7b2c34\u884c<\/span><\/p>\n

<?php<\/span> if<\/span> ( get_edit_post_link() ) : ?><\/span>\n\t\t<footer<\/span> class<\/span>=\"entry-footer\"<\/span>><\/span>\n\t\t\t<?php<\/span>\n\t\t\tedit_post_link(\n\t\t\t\tsprintf(\n\t\t\t\t\twp_kses(\n\t\t\t\t\t\t\/* translators: %s: Name of current post. Only visible to screen readers *\/<\/span>\n\t\t\t\t\t\t__( 'Edit <span class=\"screen-reader-text\">%s<\/span>'<\/span>, 'twentynineteen'<\/span> ),\n\t\t\t\t\t\tarray<\/span>(\n\t\t\t\t\t\t\t'span'<\/span> => array<\/span>(\n\t\t\t\t\t\t\t\t'class'<\/span> => array<\/span>(),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tget_the_title()\n\t\t\t\t),\n\t\t\t\t'<span class=\"edit-link\">'<\/span>,\n\t\t\t\t'<\/span>'<\/span>\n\t\t\t);\n\t\t\t?><\/span>\n\t\t<\/footer<\/span>><\/span><!-- .entry-footer --><\/span>\n\t<?php<\/span> endif<\/span>; ?><\/span>\n<\/pre>\n

 WordPress\u7f16\u8f91\u6587\u7ae0\u94fe\u63a5\u6807\u7b7e\uff1aedit_post_link<\/h2>\n

\u6765\u6e90\u4e8e\uff1a<\/strong><\/p>\n

https:\/\/www.beizigen.com\/1687.html<\/span><\/p>\n

WordPress\u6a21\u677f\u6807\u7b7eedit_post_link\u7528\u4e8e\u8f93\u51fa\u7f16\u8f91\u6587\u7ae0\u7684\u94fe\u63a5\uff0c\u5fc5\u987b\u7528\u5728The Loop\u4e3b\u5faa\u73af\u4e2d\u3002<\/p>\n

edit_post_link( string $text = null, string $before = '', string $after = '', integer $id = 0, string $class = 'post-edit-link' )\n<\/pre>\n

\u51fd\u6570\u53c2\u6570<\/h2>\n

$text<\/strong><\/p>\n

\u5b57\u7b26\u4e32\u503c\uff0c\u9ed8\u8ba4\u4e3a\u7a7a<\/p>\n

\u94fe\u63a5\u7684\u951a\u6587\u672c<\/p>\n

$before<\/strong><\/p>\n

\u5b57\u7b26\u4e32\u503c\uff0c\u9ed8\u8ba4\u4e3a\u7a7a<\/p>\n

\u5728\u94fe\u63a5\u524d\u8f93\u51fa\u7684\u6587\u672c<\/p>\n

$after<\/strong><\/p>\n

\u5b57\u7b26\u4e32\u503c\uff0c\u9ed8\u8ba4\u4e3a\u7a7a<\/p>\n

\u5728\u94fe\u63a5\u540e\u8f93\u51fa\u7684\u6587\u672c<\/p>\n

$id<\/strong><\/p>\n

\u6574\u6570\u578b\uff0c\u9ed8\u8ba4\u503c\uff1a0<\/p>\n

\u6307\u5b9a\u6587\u7ae0ID\uff0c\u8f93\u51fa\u8be5\u6587\u7ae0\u7684\u7f16\u8f91\u94fe\u63a5\u3002<\/p>\n

$class<\/strong><\/p>\n

\u5b57\u7b26\u4e32\u503c\uff0c\u9ed8\u8ba4\u503c\uff1apost-edit-link<\/p>\n

\u94fe\u63a5\u7684\u7c7b\u540d<\/p>\n

edit_post_link()\u51fd\u6570\u4f7f\u7528\u793a\u4f8b<\/h2>\n
', ''); ?>\n<\/span><\/pre>\n

\u6269\u5c55\u9605\u8bfb<\/h2>\n

edit_post_link()\u51fd\u6570\u4f4d\u4e8e\uff1awp-includes\/link-template.php<\/p>\n

\u76f8\u5173\u51fd\u6570\uff1a<\/p>\n