• 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&#039;) echo " class='selected'"; ?>><a href="https://example.com/wp-stats.php">Stats</a&gt;
    </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!

Viewing 3 replies - 16 through 18 (of 18 total)
  • That worked only now, when you click on “home” is does not stay selected. You The man!!

    Change that code back to:
    <?php if (is_home()) echo "id='selected'"; ?>

    Since I use something just like this on my own blog, I can’t figure out why it’s not working, the only thing different is that I use it in the <a> tag.

    Like this:

    <li><a <?php if (is_home()) echo "id='current'"; ?> href="<?php bloginfo('url'); ?>">Home</a></li>

    But you need to change all of the follow code to deal with that.

    If that doesn’t fix it, I’m out of ideas, well for the moment.

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Blix: Little trouble with NavBar extra button’ is closed to new replies.