{"id":533667,"date":"2007-03-07T00:45:14","date_gmt":"2007-03-07T00:45:14","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/help-with-dynamic-menu\/"},"modified":"2016-08-18T22:34:46","modified_gmt":"2016-08-18T22:34:46","slug":"help-with-dynamic-menu","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/help-with-dynamic-menu\/","title":{"rendered":"Help with Dynamic menu"},"content":{"rendered":"<p>I know I&#8217;m going to kick myself when i find out the simple mistake i made but i just don&#8217;t see it.<br \/>\nThe prob i have is I am try to get the menu to highlight base on category or posts in cats. It worked at first perfectly but for some reason it just stopped working<br \/>\nIn my header<\/p>\n<pre><code>&lt;?php if ( is_home() ) { $current = &#039;front&#039;; }\nelseif ( in_category(2) ) { $current = &#039;news&#039;; }\nelseif ( in_category(4) ) { $current = &#039;sports&#039;; }\nelseif ( in_category(5) ) { $current = &#039;comics&#039;; }\nelseif ( in_category(9) ) { $current = &#039;features&#039;; }\nelseif ( in_category(10) ) { $current = &#039;opinions&#039;; }\nelseif ( in_category(6) ) { $current = &#039;arts&#039;; }\nelseif ( is_page(51) ) { $current = &#039;archives&#039;; }\nelseif ( is_page(23) ) { $current = &#039;about&#039;; }\nelseif ( is_page(24) ) { $current = &#039;ads&#039;; }\nelseif ( is_page(52) ) { $current = &#039;contact&#039;; }\nelseif ( is_page(22) ) { $current = &#039;rss&#039;; } ?&gt;\n\n&lt;style type=&quot;text\/css&quot;&gt;\n#&lt;?php echo $current; ?&gt; a{\n background:#bd4b01 url(http:\/\/thespectrum.freehostia.com\/wp-content\/themes\/spectrum\/images\/&lt;?php if (is_page()){echo &#039;checkh&#039;;}else {echo &#039;articlesh1&#039;;}?&gt;.gif 6px 4px no-repeat;\ncolor:#fff;}\n&lt;\/style&gt;\n\nThen in the sidebar.php i have\n&lt;ul class=&quot;sections&quot;&gt;\n&lt;li id=&quot;front&quot;&gt;&lt;a ...&gt;Home&lt;\/a&gt;&lt;\/li&gt;\netc\n&lt;\/ul&gt;<\/code><\/pre>\n<p>Everything looks like it should work in the code but it just doesn&#8217;t <\/p>\n<p>www.thespectrum.freehostia.com<\/p>\n","protected":false},"template":"","class_list":["post-533667","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/533667","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\/533667\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=533667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}