[wp-hackers] Why does wp_page_menu exist?

Otto otto at ottodestruct.com
Wed Feb 4 22:01:22 GMT 2009


On Wed, Feb 4, 2009 at 2:00 PM, Dan Gayle <dangayle at gmail.com> wrote:
> Why does wp_page_menu exist? The functionality is LESS than wp_list_pages.
> For example, what if one doesn't want to have sub-pages listed? You can't if
> you choose to use wp_page_menu. In fact, it provides half of the
> functionality of wp_list_pages, while only allowing the additional use of
> adding a link to the home page, which is easily done like this:
>
> <ul id="navigation">
>        <li><a href="<?php echo get_option('home'); ?>" rtitle="<?php
> bloginfo('name'); ?> Home Page">Home</a></li>
>        <?php wp_list_pages('depth=1&sort_column=menu_order&title_li='); ?>
> </ul>
>
> So what was the reasoning behind adding a totally new function, when simply
> adding an additional option to wp_list_pages would have done the trick?

The function wp_page_menu supports everything wp_list_pages does,
along with the ability to add the home link. It's an extension to
wp_list_pages, not a replacement for it.

As for why a new function was added, I expect that it's for both
future expansion and to maintain backwards compatibility.

-Otto


More information about the wp-hackers mailing list