Support » Fixing WordPress » Creating a Current Page Tab

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter med103

    (@med103)

    Sweet Thanks!

    Thread Starter med103

    (@med103)

    That tutorial is great, but I can’t seem to get it to work, I’m having an issue with adding an id to my pages. In the header.php file I have this to call my pages
    <– <div id=”portfolio_links”>

      <li id=”current”>“>Blog
      <?php wp_list_pages(‘title_li=’); ?>

    </div> –>
    I understand that I need to change my current to something like page one or one, but how do I add an id to each of my pages?
    Thanks,

    Just check out the source code of the list generated by wp_list_pages. It always adds a “current_page_item” class to the Page you are on.

    moshu :: Wow, I didn’t know that… For simple layouts (95% of blogs) that would be just the ticket! 🙂 I really should read that codex more often.

    Thread Starter med103

    (@med103)

    Thank you moshu, I’ve got the tabs working properly now. The only thing left now is how do I get a blog link to appear when they are browsing anything blog related? I had a link like above that I got from the pool theme, but I can’t seem to get it to turn off when it’s not the blog. Thanks again for any help.

    Thread Starter med103

    (@med103)

    I’m seriously going insane trying to get this blog tab to work…I’m trying to get the dynamic menu highlighting tutorial to work and so far I can only think of a few places I could have gone wrong. In the tutorial it says if ( is_page(‘Page One’) ) page one would be the name of the page, that’s the name in the title bar correct. Also this style part.
    <style type=”text/css”>
    #<?php echo $current; ?> {
    background-color: yellow;
    }
    </style>
    I need to add this to make it work, however I have another class I need to add. If I write it like this one I get a parsing error. When I check my code id=’one’ is not replace by what I specified in { $current = ‘one’; } this part of the code. Any help would be greatly appreciated.
    Thank You,

    Thread Starter med103

    (@med103)

    Thanks to the Regulus theme I figured out how to nake the tabs work http://www.binarymoon.co.uk/regulus/. All pages work with the current_page_item, but to make the blog/home tab work you need to add

    <li <?php if (((is_home()) && !(is_paged())) or (is_archive()) or (is_single()) or (is_paged()) or (is_search())) { echo "class=\"current_page_item\""; } ?> ><a href="<?php echo get_settings('home'); ?>" ><?php _e('Home'); ?></a></li>

    This will make the blog/home tab display the current_page_item class properly.
    Thanks,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Creating a Current Page Tab’ is closed to new replies.