{"id":7341831,"date":"2016-05-02T20:33:11","date_gmt":"2016-05-02T20:33:11","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/add-widget-area-to-navigation-bar\/"},"modified":"2016-08-31T17:11:19","modified_gmt":"2016-08-31T17:11:19","slug":"add-widget-area-to-navigation-bar","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/add-widget-area-to-navigation-bar\/","title":{"rendered":"Add widget area to Navigation bar"},"content":{"rendered":"<p>I am using a child theme of Clean Box and would like to replace the search icon at the right of the navigation bar with a widget area.<\/p>\n<p>So far, I&#8217;ve registered the widget area, but am not sure how to get it to appear in the nav bar, instead of the search icon.<\/p>\n<p>As a start (just to see if I could add something to the menu successfully), I tried simply adding text to the menu items with:<\/p>\n<pre><code>add_filter( &#039;wp_nav_menu_items&#039;, &#039;add_widget_area_to_menu&#039;, 10, 2 );\nfunction add_widget_area_to_menu ( $items, $args ) {\n    if (is_single() &amp;&amp; $args-&gt;theme_location == &#039;primary&#039;) {\n        $items .= &#039;&lt;li&gt;New widget&lt;\/li&gt;&#039;;\n    }\n    return $items;\n}<\/code><\/pre>\n<p>But that didn&#8217;t have any effect on the nav bar.<\/p>\n<p>I also see that to make a widget area appear, I should use the dynamic_sidebar function &#8211; I&#8217;m just not sure where to use it.<\/p>\n<p>I&#8217;m familiar with php but new to WordPress development, and would be extremely grateful for any advice, as it will help me learn. I&#8217;m working on the site locally, so unfortunately I can&#8217;t paste a URL.<\/p>\n","protected":false},"template":"","class_list":["post-7341831","topic","type-topic","status-publish","hentry","topic-tag-nav-bar","topic-tag-widget"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7341831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7341831\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7341831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}