Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Problems with active state menu for Homepage/Activity


Gianfranco
Participant

@gian-ava

Ok, here’s my TEMPORARY fix for highlighting (printing the class=”active”) the Home menu, waiting that the bp_is_front_page() fuction get fixed (if it ever will).

The trick is simply to detect the homepage by its URL, with PHP.

So, first create a function to know that get the main url (http://site.com).

<?php
// Define base URL (homepage)
$homepage = "/";
$currentpage = $_SERVER['REQUEST_URI'];
?>

Than call the function as condition:

<li <?php if($homepage==$currentpage) { echo 'class="active"'; } ?> id="home-nav"><a href="<?php echo get_settings('home'); ?>" alt="Home">Home</a></li>

Just in case anybody else run into the same problem.

Skip to toolbar