Re: header.php buttons – selected class
i gave up and did it my own way i basically looked at the URL and checked to see if it matched, if so, then use the selected class, if not, then a dummy class. use if you like:
<?php
global $current_user;
$username = $current_user->user_login;
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "/";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"]."".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$currentURL = curPageURL();
if ( $currentURL == "http://domain.net/members/$username/mystuff/stuff-home" ) {
$dynamicClass = 'selected';
} else {
$dynamicClass = 'NOTselected';
}
?>
<li class="<?php echo $dynamicClass; ?>"><a href="<?php echo 'http://domain.net/members/'.$username.'/mystuff/stuff-home' ?>" title="<?php _e( 'My Stuff', 'buddypress' ) ?>"><?php _e( 'My Stuff', 'buddypress' ) ?></a></li>