Forums

Listing the index.php using wp_list_pages() function (3 posts)

  1. fongchun
    Member
    Posted 2 years ago #

    Hi all,

    I tried to search for this, but couldn't find anything. But basically, I am using the wp_list_pages() function to list the pages I have in my blog. But I noticed index.php doesn't show up as a page. What is the best way to list it? I am aware I could simply make it appear as a list item, and then using the wp_list_pages(). But I was thinking there was another way to do it?

    Thanks,

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    If you're not using a static page as your front page, your front page isn't class as a WordPress Page. The "fix" is use something like:

    <ul>
    <li<?php if(is_home()) echo ' class="current_page_item"';?>><a href="<?php bloginfo('url'); ?>">Home</a></li>
    <?php wp_list_pages('title_li&sort_column=post_name&sort_order=asc&hierarchical=1'); ?>
    </ul>
  3. Technokinetics
    Member
    Posted 2 years ago #

    Hi,

    As of more recent versions of WP, you can use wp_page_menu() to create a Page list with a "Home" link.

    - Tim

Topic Closed

This topic has been closed to new replies.

About this Topic