Blix: Little trouble with NavBar extra button
-
Hey guys! I’m modifing the Blix Theme in order to suit my needs and I’m having this problem: I want to use the wp-stats.php plugin and I want to show a link to that file in the NavBar. I had no problem to add a link to it on the navbar, but it doesn’t get highlighted when clicked, so I did a very little php coding and now I have this problem, the button is always highlighted, the other buttons get highlighted when chosen and work right, but the Stats Button (that’s how I called the link to the plugin) is always highlighted.
This is what I have:
<ul>
<li<?php if (is_home()) echo " class='selected'"; ?>><a>">Home</a>
<?php
$pages = BX_get_pages();
if ($pages) {
foreach ($pages as $page) {
$page_id = $page->ID;
$page_title = $page->post_title;
$page_name = $page->post_name;
if ($page_name == "archives") {
(is_page($page_id) || is_archive() || is_search() || is_single())?$selected = ' class="selected"':$selected='';
echo "<li".$selected."><a>Archives</a>n";
}
elseif($page_name == "about") {
(is_page($page_id))?$selected = ' class="selected"':$selected='';
echo "<li".$selected."><a>About</a>n";
}
elseif ($page_name == "contact") {
(is_page($page_id))?$selected = ' class="selected"':$selected='';
echo "<li".$selected."><a>Contact</a>n";
}
elseif ($page_name == "about_short") {/*ignore*/}
else {
(is_page($page_id))?$selected = ' class="selected"':$selected='';
echo "<li".$selected."><a>$page_title</a>n";
}
}
}
?>
<li<?php if ('https://example.com/tests/wp-stats.php') echo " class='selected'"; ?>><a href="https://example.com/wp-stats.php">Stats</a>
</ul>I know I’m missing something to tell the code to not highlight the button if it’s not the chosen one, and also, the home button is highlighted while viewing the stats page. I really suck with php, can any of you tell me how to fix this?
I hope you can help me! ?? Thank you very much!
- The topic ‘Blix: Little trouble with NavBar extra button’ is closed to new replies.