Personally, I wouldn't care about the ability to code links from other sites
into that navigation. I think the ability to add additional <li> to the
<ul> is fine. My concern was with the new functionality, and the goal of
making WP a little more CMS useful (assumption on my part). I know from
working with clients, they want a home link, and can see this issue coming
up on a regular basis in the forums. Obviously another work around would be
to give the desired page a slug of Home, and for most that would be fine, as
they won't be be changing the page often. I simply thought an intuitive
handling of the concept from a navigation standpoint would be nice.
Thanks for the code snippet.
Michael
On 12/23/06, Mark Jaquith <[EMAIL PROTECTED]> wrote:
On Dec 22, 2006, at 8:09 PM, Michael B wrote:
> While testing 2.1, I've noticed that if I Create a Page to be the
> "home"
> page, and do a simple horizontal navigation such as
> <ul>
> <li class="<?php if (is_home()) {echo 'page_item
> current_page_item';
> } ?>"><a href="<?php bloginfo('url'); ?>/">Home</a></li>
> <?php wp_list_pages('title_li=' ); ?>
> </ul>
>
> Both the page and a home link show in the nav bar.
There is a filter for wp_list_page() exclusions in WP 2.1 called
wp_list_pages_excludes. It passes an array of excluded page IDs (as
manually passed to the function) and you can modify the array and
return it. So you could implement that in the theme's functions.php
(untested example)
> <?php
>
> function yourthemeprefix_remove_home_link($excludes) {
> // quick exit if we're not showing a page up front or if the front
> page is already excluded
> if ( 'page' != get_option('show_on_front') || in_array(get_option
> ('page_on_front'), $excludes) )
> return $excludes;
> $excludes[] = get_option('page_on_front');
> return $excludes;
> }
>
> add_filter('wp_list_pages_excludes',
> 'yourthemeprefix_remove_home_link');
>
> ?>
The best option, I think, is not to hardcode the "Home" link in the
theme. If they want a Home link in their wp_list_pages() output,
they can use my Page Links To [1] plugin to do that. That'll work no
matter what theme they're using, and they'll be able to manually
place the link (your code forces it to always be first).
What would you think about making that functionality part of core for
2.2 or beyond? It seems to be a common problem... people frequently
want their wp_list_pages() output to have links to non-page WP
content or non-WP content (like their Flickr page or their site's
forums).
--
Mark Jaquith
http://markjaquith.com/
Covered Web Services
http://covered.be/
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers