{"id":151659,"date":"2011-08-30T08:00:00","date_gmt":"2011-08-30T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/section-subnav\/"},"modified":"2011-08-31T00:40:00","modified_gmt":"2011-08-31T00:40:00","slug":"section-subnav","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/section-subnav\/","title":{"rendered":"Section Subnav"},"content":{"rendered":"<p>This is a simple plugin that was born out of working on several projects with sectional navigations.  For example, consider the following common navigation tree structure:<\/p>\n<ul>\n<li>Home<\/li>\n<li>Item<\/li>\n<li>About Us\n<ul>\n<li>Sub-item #1<\/li>\n<li>Sub-item #2<\/li>\n<\/ul>\n<\/li>\n<li>Item<\/li>\n<li>Item<\/li>\n<\/ul>\n<p>Then, whenever on the \u201cAbout Us\u201d page or any of its sub-items, it would output that peice of the navigation:<\/p>\n<ul>\n<li>About Us\n<ul>\n<li>Sub-item #1<\/li>\n<li>Sub-item #2<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>This is particularly useful for websites that have a top horizontal navigation which shows top-level items and want to show a vertical subnavigation in the sidebar.<\/p>\n<p>This plugin works by parsing the output of the <code>wp_nav_menu<\/code> function as XML and analyzing the CSS class hooks (current-menu-ancestor, current-menu-item, and current-menu-parent).  Because it uses PHP\u2019s SimpleXML library it therefore requires PHP 5+.  It uses the theme\u2019s registered menu locations.<\/p>\n<p>This plugin also exposes the <code>section_subnav()<\/code> function for theme developers to use as a template tag to manually place a subnav inside the theme.  Here is the usage:<\/p>\n<pre><code><?php\n\n    section_subnav( array( \/\/ defaults\n        'before_widget' => '<nav id=\"section-subnav\" class=\"widget widget_section-subnav\">',\n        'after_widget' => \"<\/nav>\",\n        'before_title' => '<h3 class=\"section-subnav-title widget-title\">',\n        'after_title' => '<\/h3>',\n        'echo' => true\n    ));\n\n?>\n<\/code><\/pre>\n<p>It returns false when there is no subnavigation.<\/p>\n<p>This function also provides the <code>section_subnav_args<\/code> filter hook for writing less code and easier integration with other plugins and child themes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Adds a widget and template function for displaying subnavigation based on the current navigation state.<\/p>\n","protected":false},"author":65,"featured_media":339181,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Section Subnav - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Adds a widget and template function for displaying subnavigation based on the current navigation state."},"footnotes":""},"categories":[1],"tags":[356,978,120],"class_list":["post-151659","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-menu","tag-navigation","tag-widget"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/151659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=151659"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/151659\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/339181"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=151659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=151659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=151659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}