{"id":2319,"date":"2020-07-08T10:45:16","date_gmt":"2020-07-08T02:45:16","guid":{"rendered":"http:\/\/www.woniuseo.com\/?p=2319"},"modified":"2020-08-31T10:45:25","modified_gmt":"2020-08-31T02:45:25","slug":"%e5%a6%82%e4%bd%95%e7%ba%af%e4%bb%a3%e7%a0%81%e7%bb%99wordpress%e5%88%86%e7%b1%bb%e6%a0%8f%e7%9b%ae%e9%a1%b5%e5%a2%9e%e5%8a%a0%e8%87%aa%e5%ae%9a%e4%b9%89tdk%e6%a0%87%e9%a2%98%e6%8f%8f%e8%bf%b0","status":"publish","type":"post","link":"http:\/\/www.woniuseo.com\/2319.html","title":{"rendered":"\u5982\u4f55\u7eaf\u4ee3\u7801\u7ed9WordPress\u5206\u7c7b\u680f\u76ee\u9875\u589e\u52a0\u81ea\u5b9a\u4e49TDK\u6807\u9898\u63cf\u8ff0\u5173\u952e\u8bcd\u4fe1\u606f"},"content":{"rendered":"

\u4eca\u5929\u6709\u4f4d\u7f51\u53cb\u7528\u6237\u95ee\u6211\u600e\u4e48\u5206\u7c7b\u4e0d\u80fd\u81ea\u5b9a\u4e49\u6807\u9898\u3001\u5173\u952e\u8bcd\u3001\u63cf\u8ff0\u4fe1\u606f\uff08TDK\uff09\uff1f\u8fd9\u4e2a\u95ee\u9898\u95ee\u5f97\u521a\u521a\u597d\uff0c\u56e0\u4e3a\u6211\u6b63\u51c6\u5907\u66f4\u65b0\u4e3b\u9898\u3002\u81ea\u5b9a\u4e49\u5206\u7c7b\u9875\u7684\u6807\u9898\u5173\u952e\u8bcd\u63cf\u8ff0\u4fe1\u606f\u53ef\u4ee5\u5e2e\u52a9\u7ad9\u957f\u8fdb\u884cSEO\uff0c\u867d\u7136\u6ca1\u591a\u5927\u4f5c\u7528\u3002\u5f53\u7136\u8bbe\u7f6e\u81ea\u5df1\u5199\u7684TDK\uff0c\u603b\u6bd4WordPress\u9ed8\u8ba4\u7684\u8981\u5f3a\u5427\uff01\u5176\u5b9eWordPress\u5206\u7c7b\u589e\u52a0\u81ea\u5b9a\u4e49TDK\u5b9e\u73b0\u548c\u6587\u7ae0\u9875\u7684\u81ea\u5b9a\u4e49TDK\u5b9e\u73b0\u65b9\u5f0f\u662f\u4e00\u6837\u7684\u3002\u597d\u4e86\u4e0d\u591a\u8bf4\uff0c\u4e0b\u9762\u8fdb\u4eba\u4eca\u5929\u7684\u6559\u7a0b\u5185\u5bb9\u3002<\/p>\n

\u7eaf\u4ee3\u7801\u7ed9WordPress\u5206\u7c7b\u589e\u52a0\u81ea\u5b9a\u4e49TDK\u6807\u9898\u63cf\u8ff0\u5173\u952e\u8bcd\u4fe1\u606f
\n\u7eaf\u4ee3\u7801\u7ed9WordPress\u5206\u7c7b\u589e\u52a0\u81ea\u5b9a\u4e49TDK\u6807\u9898\u63cf\u8ff0\u5173\u952e\u8bcd\u4fe1\u606f<\/p>\n

\u9996\u5148\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\u5230\u4f60\u7684functions.php\u4e2d\uff0c\u7136\u540e\u8bbf\u95ee\u4f60\u7684WordPress\u540e\u53f0\u5206\u7c7b\u9875\u9762\uff0c\u4f60\u4f1a\u53d1\u73b0\u591a\u4e86\u5982\u4e0a\u56fe\u6240\u793a\u76843\u4e2a\u7f16\u8f91\u6846\u3002<\/p>\n

$category_meta <\/span>=<\/span> array<\/span>(<\/span> \narray<\/span>(<\/span>\n\"name\"<\/span> =><\/span> \"categorytitle\"<\/span>,<\/span>\n\"std\"<\/span> =><\/span> \"\"<\/span>,<\/span>\n\"title\"<\/span> =><\/span> __<\/span>(<\/span>'\u81ea\u5b9a\u4e49\u5206\u7c7b\u6807\u9898'<\/span>,<\/span> 'haoui'<\/span>).<\/span>'\uff1a'<\/span>,<\/span>\n'desc'<\/span> =><\/span> __<\/span>(<\/span>'\u5728HTML\u7684title\u6807\u7b7e\u4e2d\uff0c\u81ea\u5b9a\u4e49\u5206\u7c7b\u6807\u9898\u5c06\u8986\u76d6\u9ed8\u8ba4\u5206\u7c7b\u6807\u9898'<\/span>,<\/span> 'haoui'<\/span>)<\/span>\n),<\/span>\narray<\/span>(<\/span>\n\"name\"<\/span> =><\/span> \"categorykws\"<\/span>,<\/span>\n\"std\"<\/span> =><\/span> \"\"<\/span>,<\/span>\n\"title\"<\/span> =><\/span> __<\/span>(<\/span>'\u81ea\u5b9a\u4e49\u5206\u7c7b\u5173\u952e\u8bcd'<\/span>,<\/span> 'haoui'<\/span>).<\/span>'\uff1a'<\/span>,<\/span>\n'desc'<\/span> =><\/span> __<\/span>(<\/span>'\u5728HTML\u7684keywords\u6807\u7b7e\u4e2d\uff0c\u81ea\u5b9a\u4e49\u5206\u7c7b\u5173\u952e\u8bcd\u5c06\u8986\u76d6\u9ed8\u8ba4\u5206\u7c7b\u5173\u952e\u8bcd'<\/span>,<\/span> 'haoui'<\/span>)<\/span>\n),<\/span>\narray<\/span>(<\/span>\n\"name\"<\/span> =><\/span> \"categorydes\"<\/span>,<\/span>\n\"std\"<\/span> =><\/span> \"\"<\/span>,<\/span>\n\"title\"<\/span> =><\/span> __<\/span>(<\/span>'\u81ea\u5b9a\u4e49\u5206\u7c7b\u63cf\u8ff0'<\/span>,<\/span> 'haoui'<\/span>).<\/span>'\uff1a'<\/span>,<\/span>\n'desc'<\/span> =><\/span> __<\/span>(<\/span>'\u5728HTML\u7684description\u6807\u7b7e\u4e2d\uff0c\u81ea\u5b9a\u4e49\u5206\u7c7b\u63cf\u8ff0\u5c06\u8986\u76d6\u9ed8\u8ba4\u5206\u7c7b\u63cf\u8ff0'<\/span>,<\/span> 'haoui'<\/span>)<\/span>\n)<\/span>\n);<\/span>\n\nfunction<\/span> dmd_add_category_field<\/span>(){<\/span>\nglobal<\/span> $category_meta<\/span>;<\/span>\nforeach<\/span>(<\/span>$category_meta <\/span>as<\/span> $meta_box<\/span>)<\/span> {<\/span>\necho <\/span>'<div class=\"form-field\">\n<label for=\"'<\/span>.<\/span>$meta_box<\/span>[<\/span>'name'<\/span>].<\/span>'\">'<\/span>.<\/span>$meta_box<\/span>[<\/span>'title'<\/span>].<\/span>'<\/label>\n<input name=\"'<\/span>.<\/span>$meta_box<\/span>[<\/span>'name'<\/span>].<\/span>'\" id=\"'<\/span>.<\/span>$meta_box<\/span>[<\/span>'name'<\/span>].<\/span>'\" type=\"text\" value=\"\" size=\"40\">\n<p>'<\/span>.<\/span>$meta_box<\/span>[<\/span>'desc'<\/span>].<\/span>'<\/p>\n<\/div>'<\/span>;<\/span>\n}<\/span> \n}<\/span>\n\nfunction<\/span> dmd_edit_category_field<\/span>(<\/span>$tag<\/span>){<\/span>\nglobal<\/span> $category_meta<\/span>;<\/span>\nforeach<\/span>(<\/span>$category_meta <\/span>as<\/span> $meta_box<\/span>)<\/span> {<\/span>\necho <\/span>'<tr class=\"form-field\">\n<th scope=\"row\"><label for=\"'<\/span>.<\/span>$meta_box<\/span>[<\/span>'name'<\/span>].<\/span>'\">'<\/span>.<\/span>$meta_box<\/span>[<\/span>'title'<\/span>].<\/span>'<\/label><\/th>\n<td>\n<input name=\"'<\/span>.<\/span>$meta_box<\/span>[<\/span>'name'<\/span>].<\/span>'\" id=\"'<\/span>.<\/span>$meta_box<\/span>[<\/span>'name'<\/span>].<\/span>'\" type=\"text\" value=\"'<\/span>;<\/span> \necho get_option<\/span>(<\/span>''<\/span>.<\/span>$meta_box<\/span>[<\/span>'name'<\/span>].<\/span>'-'<\/span>.<\/span>$tag<\/span>-><\/span>term_id<\/span>).<\/span>'\" size=\"40\"\/><br>\n<span class=\"'<\/span>.<\/span>$meta_box<\/span>[<\/span>'name'<\/span>].<\/span>'\">'<\/span>.<\/span>$meta_box<\/span>[<\/span>'desc'<\/span>].<\/span>'<\/span>\n<\/td>\n<\/tr>'<\/span>;<\/span>\n}<\/span> \n}<\/span>\n\nfunction<\/span> dmd_category_save<\/span>(<\/span>$term_id<\/span>){<\/span>\nglobal<\/span> $category_meta<\/span>;<\/span>\nforeach<\/span>(<\/span>$category_meta <\/span>as<\/span> $meta_box<\/span>)<\/span> {<\/span>\n$data <\/span>=<\/span> $_POST<\/span>[<\/span>$meta_box<\/span>[<\/span>'name'<\/span>]];<\/span>\nif<\/span>(<\/span>isset<\/span>(<\/span>$data<\/span>)){<\/span>\nif<\/span>(!<\/span>current_user_can<\/span>(<\/span>'manage_categories'<\/span>)){<\/span>\nreturn<\/span> $term_id<\/span>;<\/span>\n}<\/span>\n$key <\/span>=<\/span> $meta_box<\/span>[<\/span>'name'<\/span>].<\/span>'-'<\/span>.<\/span>$term_id<\/span>;<\/span>\nupdate_option<\/span>(<\/span> $key<\/span>,<\/span> $data <\/span>);<\/span>\n}<\/span>\n}<\/span>\n}<\/span>\nadd_action<\/span>(<\/span>'category_add_form_fields'<\/span>,<\/span>'dmd_add_category_field'<\/span>,<\/span>10<\/span>,<\/span>2<\/span>);<\/span>\nadd_action<\/span>(<\/span>'category_edit_form_fields'<\/span>,<\/span>'dmd_edit_category_field'<\/span>,<\/span>10<\/span>,<\/span>2<\/span>);<\/span>\nadd_action<\/span>(<\/span>'created_category'<\/span>,<\/span>'dmd_category_save'<\/span>,<\/span>10<\/span>,<\/span>1<\/span>);<\/span>\nadd_action<\/span>(<\/span>'edited_category'<\/span>,<\/span>'dmd_category_save'<\/span>,<\/span>10<\/span>,<\/span>1<\/span>);<\/span><\/pre>\n

\u4e0a\u9762\u4e00\u5171\u4e09\u4e2a\u65b9\u6cd5\uff0c\u4ece\u4e0a\u81f3\u4e0b\u5206\u522b\u662f\u65b0\u5efa\u5206\u7c7b\u9875\u65f6\u521b\u5efa\u7f16\u8f91\u6846\uff0c\u7f16\u8f91\u5206\u7c7b\u9875\u65f6\u521b\u5efa\u7f16\u8f91\u6846\u4ee5\u53ca\u4fdd\u5b58\u7f16\u8f91\u6846\u6570\u636e\u5230options\u8868\u4e2d\u3002<\/p>\n

\u6709\u4e86\u8fd9\u4e9b\u65b9\u6cd5\u4f60\u5df2\u7ecf\u53ef\u4ee5\u81ea\u5b9a\u4e49\u5206\u7c7b\u9875\u7684TDK\u4e86\uff0c\u53ea\u662f\u4f60\u7684\u4e3b\u9898\u5374\u4e0d\u80fd\u663e\u793a\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u4fee\u6539\u4e3b\u9898\u8f93\u51fa\u7684\u4ee3\u7801\uff0c\u8fd9\u4e2a\u4ee3\u7801\u4e0d\u56fa\u5b9a\uff0c\u5176\u5b83\u4e3b\u9898\u6709\u76f4\u63a5\u4fee\u6539functions-theme.php\u4e2d_title\u65b9\u6cd5\u4e2d\u5173\u4e8e\u5206\u7c7b\u9875\u7684\u8f93\u51fa\u5373\u53ef\u3002<\/p>\n

\u8f93\u51fa\u81ea\u5b9a\u4e49\u5206\u7c7b\u4fe1\u606f\u4f7f\u7528\u5982\u4e0b\u65b9\u6cd5\uff1a<\/p>\n

get_option<\/span>(<\/span>'\u521b\u5efa\u7f16\u8f91\u6846\u7684name-'<\/span>.<\/span>$cat_ID<\/span>);<\/span><\/pre>\n

$cat_ID<\/code>\u6307\u5206\u7c7b\u5f53\u524d\u5206\u7c7bid\uff0c\u53ef\u4ee5\u901a\u8fc7get_query_var('cat')<\/code>\u65b9\u6cd5\u62ff\u5230\u3002<\/p>\n

\u611f\u8c22\u672c\u6587\u4f5c\u8005\uff0c\u539f\u521b\u5730\u5740\uff1ahttps:\/\/www.daimadog.com\/4606.html<\/p>\n

\u611f\u8c22\u6211\u53d1\u73b0\u672c\u6587\u7684\u8f6c\u8f7d\u8005\uff0c\u8f6c\u8f7d\u5730\u5740\uff1ahttps:\/\/www.2kss.com\/49655.html<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5982\u4f55\u7eaf\u4ee3\u7801\u7ed9WordPress\u5206\u7c7b\u680f\u76ee\u9875\u589e\u52a0\u81ea\u5b9a\u4e49TDK\u6807\u9898\u63cf\u8ff0\u5173\u952e\u8bcd\u4fe1\u606f\uff1f\u600e\u4e48\u7ed9wordpress\u680f\u76ee\u9875\u589e\u52a0tkd\uff1f\u600e\u4e48\u7eaf\u4ee3\u7801\u7ed9wordpress\u680f\u76ee\u9875\u589e\u52a0\u81ea\u5b9a\u4e49tkd\u4fe1\u606f\u8f93\u5165\u6846\uff1fwordpress\u7684\u5206\u7c7b\u76ee\u5f55\u600e\u4e48\u81ea\u5b9a\u4e49tkd\uff0ctitle,keywords,description\uff1f\u600e\u4e48\u7ed9wordpress\u7684\u5206\u7c7b\u76ee\u5f55\u589e\u52a0\u81ea\u5b9a\u4e49\u6807\u9898\u63cf\u8ff0\u5173\u952e\u8bcd\uff1f<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.woniuseo.com\/wp-json\/wp\/v2\/posts\/2319"}],"collection":[{"href":"http:\/\/www.woniuseo.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.woniuseo.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.woniuseo.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.woniuseo.com\/wp-json\/wp\/v2\/comments?post=2319"}],"version-history":[{"count":1,"href":"http:\/\/www.woniuseo.com\/wp-json\/wp\/v2\/posts\/2319\/revisions"}],"predecessor-version":[{"id":2320,"href":"http:\/\/www.woniuseo.com\/wp-json\/wp\/v2\/posts\/2319\/revisions\/2320"}],"wp:attachment":[{"href":"http:\/\/www.woniuseo.com\/wp-json\/wp\/v2\/media?parent=2319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.woniuseo.com\/wp-json\/wp\/v2\/categories?post=2319"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.woniuseo.com\/wp-json\/wp\/v2\/tags?post=2319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}