WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Displaying frontpage in page list (5 posts)

  1. wimmulder
    Member
    Posted 8 years ago #

    Hi,

    I'm using the wp_list_pages(); command to make a list of pages on our website. I style this list to appear at the top of our site as a navigation bar. But what i want to do is show all the links, including the front page. I know this is not a "page" but is there a way to make it show in the list that gets put out by the wp_list_pages command? It would be really convenient to use for our navigation bar. And if it's not possible to do this, is there another easy way to make a good dynamic navigation bar?

    The URL is:
    http://www.postponers.com/wordpress/

    Thanks,
    Wim Mulder

  2. moshu
    Member
    Posted 8 years ago #

  3. niziol
    Member
    Posted 8 years ago #

    I've used this code on my still developing WordPress site, it displays the home link and adds the current page class so it will be highlighted as well. Just modify the is_home to whatever function works best to indentify the page you want:

    <?php
    $pg_li="page_item";
    if (is_home()) {$pg_li .=" current_page_item";}
    ?>

    <li class="<?php echo $pg_li; ?>"><a href="<?php bloginfo('siteurl'); ?>" title="Home">Home</a></li>

    Then for the listing of the WP pages, you can use: <?php wp_list_pages('title_li='); ?>. Give it a try if it does what you'd like and let me know if you need any help with it.

    Cheers,
    Michael.

  4. wimmulder
    Member
    Posted 8 years ago #

    Thanks, that worked as a charm

  5. spencerp
    Member
    Posted 8 years ago #

    Hmm..not sure if the one that Ainslie got working for me is basically like that one. But here is what I'm using on my http://www.vindictivebastard.net/blog3/ test site.

    <!-- Sets li class -->
    <?php if (is_page()) { $highlight = "page_item"; } else {$highlight = "page_item current_page_item"; } ?>

    <div id="navigation">
    <ul>
    <li class="<?php echo $highlight; ?>"><a href="<?php echo get_settings('home'); ?>">Home</a></li>
    <?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
    </ul>

    Of course the CSS file that contains the imagery and stuff to.. =) Maybe I really didn't need to use the above following codes that I have, and could have went more simpler like your's niziol, or something....mmmm..

    spencerp

Topic Closed

This topic has been closed to new replies.

About this Topic