• Jabbok

    (@jabbok)


    Can something like this be integrated into the pages of WP? I know we have the option of designating “pages” … like 1,2,3, etc. but I was wondering if that could be turned into a tab function?

Viewing 11 replies - 1 through 11 (of 11 total)
  • empirikal

    (@empirikal)

    I’m also looking for something similar, I made the pages and manually went in and wrote the html for http://www.zenwindows.com

    But If I rename the pages, or make new pages, I have to go back in manually and update them.

    Any ideas?

    stevensj2

    (@stevensj2)

    I thought about this too, and for what it’s worth, I think the best option is not using WP’s Pages, and uploading your own HTML instead.

    You still have to manually edit stuff, but the way WP does “Pages”, it doesn’t give you any more options or advantages over doing it all manually.

    You could make it so that creating a new WP-Page would make a new tab – but this would effect the kinds of tabs you want to use. If you want all your tabs the same color, with only a color change on hover, then this would be OK.

    But if you want to have it so the tab designated to the page you are currently viewing is a different color so it stands out and lets you know where you are, you’ll have to upload your own HTML content.

    I chose to go with uploading my own.

    You can see the tabs I’ve done @ http://www.nautilus7.com

    empirikal

    (@empirikal)

    maybe If I get bored enough, Ill try making a plugin/hack for this… shouldn’t take too long… just need to dig through this stuff.

    empirikal

    (@empirikal)

    I just need to find where the “wp_list_pages” function is originally created and edit that slightly… then just add some custom css to a div like I’ve already done on my previous post and violá.

    TechGnome

    (@techgnome)

    stevensj2 – have you read the codex on the list pages function?
    http://codex.wordpress.org/Template_Tags/wp_list_pages

    Specifically the part that reads: All list items (<li>) generated by this tag will be given the CSS class “page_item”. When wp_list_pages is called while displaying a Page, the list item for that Page will be given the additional CSS class “current_page_item”.
    Which means that if you style for the class “current_page_item” to a different color that of page_item, the selected “tab” will look different from the rest.

    You still have to manually edit stuff, but the way WP does “Pages”, it doesn’t give you any more options or advantages over doing it all manually.stevensj2

    Actualy it has mass advantage over doing it by hand. 1) Your pages and posts will be given the same look & feel. 2) When you add a page, it is automatically added to your menu (results will vary based on options) otherwise you have to code it in by hand. 3) Do it once and fugetabout it. This combines 1 & 2…. if you add a page, the menu is updated on all pages…. by hand you run the risk of missing an update to a page.

    Tg

    empirikal

    (@empirikal)

    OK, So I’m gonna do a basic run down of what I just did, you will most likely have to customize this on your own, and I dont take any responsibility should you blow up your computer or something.

    I first located the function in the “wp-includes” folder in the file “template-functions-post.php”

    On line #324 in the above file I simply changed
    echo '<li id="pagenav">' . $r['title_li'] . '<ul>'; to this
    echo '<ul>';

    On line #355 I removed the following
    </li>

    Then this is basically your turn to style it however you want, but I simply copied
    <?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>' ); ?>
    from the sidebar.php in your theme folder and changed it to <?php wp_list_pages(); ?>

    I dropped that into my header.php wrapped in a div with an ID and styled it in my styles.css.

    Works great. Hope this helps.

    //edit, looking back over, you could probably just get away with just removing this from line #324 . $r['title_li'] . ' and style the id’s that are already there.. but whatever works for you.

    empirikal

    (@empirikal)

    or I could have read techgnomes post. LOL

    TechGnome

    (@techgnome)

    Editing the core files is bad juju…. because you never remember every thing you changed, and the next time you upgrade…. POOF! It’ll be gone. also by using title_li='.__('Pages')); you would effectively be removing line 324… and that’s how (according to the documentation) it works. In fact, on my test site, I did just that…. and haven’t had any problems stlying anything.

    Tg

    empirikal

    (@empirikal)

    I didn’t know that information existed, could have made my life easier.. LOL

    TechGnome

    (@techgnome)

    When in doubt always consult the Codex Oracle.

    Tg

    stevensj2

    (@stevensj2)

    I see – didn’t know the codex had that.

    Still though, I don’t think there’s much difference, and by doing it manually, there’s no reason it should look any different at all.

    Plus, adding pages manually gives you the HUGE benefit of being able to have different information in the sidebar, individual to each page. Maybe that’s in the codex too, but if I’m creating individiual static pages, I’d like them to be completely seperate of one another and not be based on the same structure if I don’t want that.

    Since it’s static content, and no way is easier or more difficult, I think it all comes down to personal preference.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Tabs in Pages’ is closed to new replies.