{"id":237,"date":"2022-05-22T17:41:58","date_gmt":"2022-05-22T09:41:58","guid":{"rendered":"https:\/\/www.xyn4.cn\/?p=237"},"modified":"2022-09-06T23:47:35","modified_gmt":"2022-09-06T15:47:35","slug":"wordpress-%e5%af%bc%e8%88%aa%e8%b0%83%e5%8f%96%e4%ba%8c%e7%ba%a7%e5%88%86%e7%b1%bb%e5%92%8c%e4%ba%8c%e7%ba%a7%e5%88%86%e7%b1%bb%e4%b8%8b%e7%9a%84%e4%ba%a7%e5%93%81","status":"publish","type":"post","link":"https:\/\/www.xyn4.cn\/?p=237","title":{"rendered":"wordpress \u8c03\u7528\u680f\u76ee\u96c6\u5408"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\u5bfc\u822a\u8c03\u53d6\u4e8c\u7ea7\u5206\u7c7b\u548c\u4e8c\u7ea7\u5206\u7c7b\u4e0b\u7684\u4ea7\u54c1\n&lt;?php\n                                \n                                    $categories =  get_categories('child_of=2&amp;depth=0&amp;hide_empty=0');   \n                                    foreach ($categories as $category) {  \n                                        $now_cat = $category->term_id;\n                                        $cat_name = $category->cat_name;\n                                ?> \n                      &lt;div class=\"menu_down_clm\">\n                      &lt;a class=\"menu_down_clm_tt\" href=\"&lt;?php echo get_category_link($category); ?>\" title=\"&lt;?php echo $cat_name; ?>\">\n                        &lt;?php echo $cat_name; ?>\n                      &lt;\/a>  \n                      &lt;div class=\"menu_down_clm_down\">\n                          \n\n\n                      \t\t&lt;?php\n                                            $args = array(\n                                            'post_type' => 'post',\n                                            'showposts' => 100,\n                                            \n                                            'cat' => array($now_cat),\/\/\u6307\u5b9a\u5206\u7c7bid\n                                            );\n                                        ?>\n                                        &lt;?php\n                                            $catquery = new WP_Query($args);\n                                            while($catquery->have_posts()) : $catquery->the_post();\n                                            \n                                        ?>\n                                    &lt;a href=\"&lt;?php the_permalink(); ?>\" title=\"&lt;?php the_title();?>\">&lt;?php the_title();?>&lt;\/a>\n                                    &lt;?php endwhile; wp_reset_query();?>\n\n\n                      &lt;\/div>\n                    &lt;\/div>\n                      &lt;?php }?>\n\n\n\nwp \u8c03\u53d6\u6307\u5b9a\u4e00\u7ea7\u680f\u76ee\u7684\u4e8c\u7ea7\u5206\u7c7b\n\n&lt;?php\n                            $a=get_category_root_id(1);\n                            $args=array(\n                            'orderby'    => 'id',\n                            'hide_empty' => \"0\",\n                            'child_of' => $a,\/\/\u53ef\u4ee5\u6362\u4e3a\uff1a'child_of' => '1', \/\/ \u8fd9\u4e2a\u53c2\u6570\u662f\u4ec0\u4e48\uff0c\u8fd8\u5728\u786e\u8ba4\u3002\n                            );\n                            $categories=get_categories($args);\n                            foreach($categories as $category) {\n                        ?>\n                        &lt;a href=\"&lt;?php echo get_category_link( $category->term_id )  ?> \">\n                           &lt;?php echo get_the_category_by_ID( $category->term_id ) ?>\n                        &lt;\/a>\n                        &lt;?php }?>   \n\n\n\nwp \u8c03\u53d6\u4e8c\u7ea7\u5206\u7c7b\u4e0b\u7684\u4e09\u7ea7\u7c7b\n\n&lt;?php\n                                    \n                                        $categories =  get_categories('child_of=1&amp;depth=0&amp;hide_empty=0&amp;orderby=id&amp;order=asc');   \n                                        foreach ($categories as $category) {  \n                                            $now_cat = $category->term_id;\n                                            $cat_name = $category->cat_name;\n                                            $cat_id = $category->cat_ID;\n                                    ?> \n                            &lt;a href=\"&lt;?php echo get_category_link($category); ?>\" title=\"&lt;?php echo $cat_name; ?>\" id=\"nav_&lt;?php echo $cat_id; ?>\">\n                                &lt;div class=\"icon iconfont icon-jia\">&lt;\/div>\n                                &lt;div class=\"tt\">\n                                    &lt;?php echo $cat_name; ?>\n                                &lt;\/div>\n                            &lt;\/a>\n\n &lt;?php $categories2 =  get_categories(\"parent=$cat_id&amp;depth=0&amp;hide_empty=0&amp;orderby=id&amp;order=asc\"); \r\n    foreach ($categories2 as $category2) {\r\n    $cat_name = $category2->cat_name;\r\n?>\r\n&lt;a href=\"&lt;?php echo get_category_link($category2); ?>\" title=\"&lt;?php echo $cat_name; ?>\">\r\n    &lt;?php echo $cat_name; ?>\r\n&lt;\/a>\r\n&lt;?php }?>\n\n\n                            &lt;?php }?>\n\n\nwordpress \u8c03\u53d6\u4e8c\u7ea7\u548c\u4e8c\u7ea7\u4e0b\u5206\u7c7b\u7684\u65b9\u6cd5\n\n&lt;?php wp_list_cats('sort_column=name&amp;optioncount=0&amp;hierarchical=1&amp;hide_empty=0&amp;child_of=1'); ?>\n\n\n\u8c03\u53d6\u6240\u6709\u4e8c\u7ea7\u7684\u65b9\u6cd5\n\n\n&lt;?php\n                                \n                            $categories =  get_categories('child_of=1&amp;depth=0&amp;hide_empty=0&amp;orderby=id&amp;order=asc');   \n                            foreach ($categories as $category) {  \n                                $now_cat = $category->term_id;\n                                $cat_name = $category->cat_name;\n                                $cat_id = $category->cat_ID;\n                        ?> \n                            &lt;li id=\"nav_&lt;?php echo $cat_id; ?>\">\n    \t\t\t\t\t\t&lt;a href=\"&lt;?php echo get_category_link($category); ?>\" title=\"&lt;?php echo $cat_name; ?>\" >&lt;?php echo $cat_name; ?> >&lt;\/a>\n    \t\t\t\t\t\t&lt;\/li>\n\t\t\t\t\t\t&lt;?php }?><\/code><\/pre>\n\n\n\n<p><\/p>\n<noscript><style>article img.lazyload[src^=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPg\"]{display: none;}<\/style><\/noscript>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-237","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>wordpress \u8c03\u7528\u680f\u76ee\u96c6\u5408 - \u7406\u60f3\u4e09\u65ec\u535a\u5ba2<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.xyn4.cn\/?p=237\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"wordpress \u8c03\u7528\u680f\u76ee\u96c6\u5408 - \u7406\u60f3\u4e09\u65ec\u535a\u5ba2\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.xyn4.cn\/?p=237\" \/>\n<meta property=\"og:site_name\" content=\"\u7406\u60f3\u4e09\u65ec\u535a\u5ba2\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-22T09:41:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-06T15:47:35+00:00\" \/>\n<meta name=\"author\" content=\"lzf\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"lzf\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.xyn4.cn\/#website\",\"url\":\"https:\/\/www.xyn4.cn\/\",\"name\":\"\u7406\u60f3\u4e09\u65ec\u535a\u5ba2\",\"description\":\"\u53c8\u4e00\u4e2aWordPress\u7ad9\u70b9\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.xyn4.cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.xyn4.cn\/?p=237\",\"url\":\"https:\/\/www.xyn4.cn\/?p=237\",\"name\":\"wordpress \u8c03\u7528\u680f\u76ee\u96c6\u5408 - \u7406\u60f3\u4e09\u65ec\u535a\u5ba2\",\"isPartOf\":{\"@id\":\"https:\/\/www.xyn4.cn\/#website\"},\"datePublished\":\"2022-05-22T09:41:58+00:00\",\"dateModified\":\"2022-09-06T15:47:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.xyn4.cn\/#\/schema\/person\/1aa4e9bb2ca9ebffc5d1925d017e2332\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.xyn4.cn\/?p=237#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.xyn4.cn\/?p=237\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.xyn4.cn\/?p=237#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.xyn4.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"wordpress \u8c03\u7528\u680f\u76ee\u96c6\u5408\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.xyn4.cn\/#\/schema\/person\/1aa4e9bb2ca9ebffc5d1925d017e2332\",\"name\":\"lzf\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.xyn4.cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/cn.gravatar.com\/avatar\/a2e850dc4ffdb86146e97bf818fc8ed6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/cn.gravatar.com\/avatar\/a2e850dc4ffdb86146e97bf818fc8ed6?s=96&d=mm&r=g\",\"caption\":\"lzf\"},\"sameAs\":[\"http:\/\/www.lzfblog.com\"],\"url\":\"https:\/\/www.xyn4.cn\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"wordpress \u8c03\u7528\u680f\u76ee\u96c6\u5408 - \u7406\u60f3\u4e09\u65ec\u535a\u5ba2","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.xyn4.cn\/?p=237","og_locale":"zh_CN","og_type":"article","og_title":"wordpress \u8c03\u7528\u680f\u76ee\u96c6\u5408 - \u7406\u60f3\u4e09\u65ec\u535a\u5ba2","og_url":"https:\/\/www.xyn4.cn\/?p=237","og_site_name":"\u7406\u60f3\u4e09\u65ec\u535a\u5ba2","article_published_time":"2022-05-22T09:41:58+00:00","article_modified_time":"2022-09-06T15:47:35+00:00","author":"lzf","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"lzf","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.xyn4.cn\/#website","url":"https:\/\/www.xyn4.cn\/","name":"\u7406\u60f3\u4e09\u65ec\u535a\u5ba2","description":"\u53c8\u4e00\u4e2aWordPress\u7ad9\u70b9","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.xyn4.cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"https:\/\/www.xyn4.cn\/?p=237","url":"https:\/\/www.xyn4.cn\/?p=237","name":"wordpress \u8c03\u7528\u680f\u76ee\u96c6\u5408 - \u7406\u60f3\u4e09\u65ec\u535a\u5ba2","isPartOf":{"@id":"https:\/\/www.xyn4.cn\/#website"},"datePublished":"2022-05-22T09:41:58+00:00","dateModified":"2022-09-06T15:47:35+00:00","author":{"@id":"https:\/\/www.xyn4.cn\/#\/schema\/person\/1aa4e9bb2ca9ebffc5d1925d017e2332"},"breadcrumb":{"@id":"https:\/\/www.xyn4.cn\/?p=237#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.xyn4.cn\/?p=237"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.xyn4.cn\/?p=237#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.xyn4.cn\/"},{"@type":"ListItem","position":2,"name":"wordpress \u8c03\u7528\u680f\u76ee\u96c6\u5408"}]},{"@type":"Person","@id":"https:\/\/www.xyn4.cn\/#\/schema\/person\/1aa4e9bb2ca9ebffc5d1925d017e2332","name":"lzf","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.xyn4.cn\/#\/schema\/person\/image\/","url":"https:\/\/cn.gravatar.com\/avatar\/a2e850dc4ffdb86146e97bf818fc8ed6?s=96&d=mm&r=g","contentUrl":"https:\/\/cn.gravatar.com\/avatar\/a2e850dc4ffdb86146e97bf818fc8ed6?s=96&d=mm&r=g","caption":"lzf"},"sameAs":["http:\/\/www.lzfblog.com"],"url":"https:\/\/www.xyn4.cn\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/www.xyn4.cn\/index.php?rest_route=\/wp\/v2\/posts\/237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xyn4.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xyn4.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xyn4.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xyn4.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=237"}],"version-history":[{"count":5,"href":"https:\/\/www.xyn4.cn\/index.php?rest_route=\/wp\/v2\/posts\/237\/revisions"}],"predecessor-version":[{"id":266,"href":"https:\/\/www.xyn4.cn\/index.php?rest_route=\/wp\/v2\/posts\/237\/revisions\/266"}],"wp:attachment":[{"href":"https:\/\/www.xyn4.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xyn4.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xyn4.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}