Quantcast
Channel: bbPress.org » All Posts
Viewing all articles
Browse latest Browse all 3638

Reply To: how does bbpress.org keep highlighting the current page?

$
0
0

Sure – this is what I did on a test install. The current menu item class in mine is “current-menu-item” and I added a custom class “forum-class” to the forum menu item in my custom menu. I *always* forget that I need to unhide the css class input by ticking the box in “Screen options” at the top of the “edit menus” screen in admin. You probably don’t but I thought I’d mention. :) Then I use that for the jQuery.

So:

1 – add “forum-class” to your forums menu item in your custom menu
2 – add this to your js file with YOURURL = the url of your site and forums = your forums slug :

$(function() { 
	      var forumURL = window.location.href.indexOf("YOURURL/forums/");
	      if(forumURL > -1){
	      	$('li.forum-class').addClass('current-menu-item');
	      }
	}); 

nb: addClass won’t add duplicate classes so no need to test if it’s already there.


Viewing all articles
Browse latest Browse all 3638

Trending Articles