{"id":30222,"date":"2013-01-02T18:41:12","date_gmt":"2013-01-03T02:41:12","guid":{"rendered":"http:\/\/tri.be\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/"},"modified":"2013-01-02T18:41:12","modified_gmt":"2013-01-03T02:41:12","slug":"update-calendar-nav-menu-item-with-current-class","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/","title":{"rendered":"Update &quot;Calendar&quot; Nav Menu Item with &quot;current&quot; class"},"content":{"rendered":"<p>Hello,<br \/>\nI just found and modified <a href=\"http:\/\/www.rarescosma.com\/2010\/11\/add-a-class-to-wp_nav_menu-items-with-urls-included-in-the-current-url\/\">this function<\/a> from Rares Cosma, many thanks to whomever that is.<\/p>\n<p>Here&#8217;s the problem that it almost solved, and that I hacked further to fully solve: I&#8217;m using the WP 3.x &#8220;Menu&#8221; (dashboard &gt; Appearance &gt; Menu). When I&#8217;m on my custom created Calendar page, the menu adds a current-menu-item class that I can style. Yay! <\/p>\n<p>However, when I switch over to view single events, venues (and, in my case, organizers\u2014I updated the tribe_organizer post type to include the slug and rewrite the url), the WordPress nav doesn&#8217;t have that nifty class added.<\/p>\n<p>So, <a href=\"http:\/\/pastebin.com\/U2ZNM4eQ\">this pastebin<\/a> includes both functions that Rares Cosma created, with my additions to search for those additional bits of the path. I also modified the original function to add current-menu-item to the class, whereas Rares&#8217; function added &#8216;parent_url&#8217; to the class. You can put whatever you want on there.<\/p>\n","protected":false},"template":"","class_list":["post-30222","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Update &quot;Calendar&quot; Nav Menu Item with &quot;current&quot; class -<\/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:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Update &quot;Calendar&quot; Nav Menu Item with &quot;current&quot; class -\" \/>\n<meta property=\"og:description\" content=\"Hello, I just found and modified this function from Rares Cosma, many thanks to whomever that is. Here&#8217;s the problem that it almost solved, and that I hacked further to fully solve: I&#8217;m using the WP 3.x &#8220;Menu&#8221; (dashboard &gt; Appearance &gt; Menu). When I&#8217;m on my custom created Calendar page, the menu adds a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/\",\"name\":\"Update &quot;Calendar&quot; Nav Menu Item with &quot;current&quot; class -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2013-01-03T02:41:12+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Update &quot;Calendar&quot; Nav Menu Item with &quot;current&quot; class\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Update &quot;Calendar&quot; Nav Menu Item with &quot;current&quot; class -","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:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/","og_locale":"en_US","og_type":"article","og_title":"Update &quot;Calendar&quot; Nav Menu Item with &quot;current&quot; class -","og_description":"Hello, I just found and modified this function from Rares Cosma, many thanks to whomever that is. Here&#8217;s the problem that it almost solved, and that I hacked further to fully solve: I&#8217;m using the WP 3.x &#8220;Menu&#8221; (dashboard &gt; Appearance &gt; Menu). When I&#8217;m on my custom created Calendar page, the menu adds a [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/","name":"Update &quot;Calendar&quot; Nav Menu Item with &quot;current&quot; class -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2013-01-03T02:41:12+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/update-calendar-nav-menu-item-with-current-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Update &quot;Calendar&quot; Nav Menu Item with &quot;current&quot; class"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/30222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/30222\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=30222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}