[theme-reviewers] Change 'add_custom_header' from _must_ include to ...
Edward Caissie
edward.caissie at gmail.com
Sat Jul 17 02:17:25 UTC 2010
This is what I am upgrading Desk Mess Mirrored to:
// Add wp_nav_menu() custom menu support
add_theme_support( 'menus' );
function dmm_nav_menu() {
if ( function_exists( 'wp_nav_menu' ) )
wp_nav_menu( array(
'theme_location' => 'top-menu',
'depth' => 1,
'fallback_cb' => 'dmm_list_pages'
) );
else
dmm_list_pages();
}
function dmm_list_pages() {
if ( is_home() || is_front_page()) {
wp_list_pages( 'title_li=&depth=1' );
} else { ?>
<li><a href="<?php bloginfo( 'url' ); ?>"><?php _e( 'Home',
'desk-mess-mirrored' ) ?></a></li>
<?php wp_list_pages( 'title_li=&depth=1' );
}
}
add_action( 'init', 'register_dmm_menu' );
function register_dmm_menu() {
register_nav_menu( 'top-menu', __( 'Top Menu' ) );
}
// wp_nav_menu() end
----
It's not 100% tested but it should cover the use of wp_nav_menu function
well enough. Of course, this is a simple use of wp_list_pages but I am sure
it is easily made more robust by editing the function called by
'fallback_cb'. I could have dropped the entire old code section that I was
using with wp_list_pages into the dmm_list_pages function but I chose to
simplify a bit when implementing wp_nav_menu.
Cais.
On Fri, Jul 16, 2010 at 8:32 PM, Chip Bennett <chip at chipbennett.net> wrote:
> My primary issue with making use of nav_menu() mandatory for navigation
> menus
> is that the function is nowhere near feature-parity with wp_list_pages(),
> especially with respect to automatic child-page navigation and dynamic
> update
> of menu_order and changing page hierarchy.
>
> For a primarily page-driven website, nav_menu() is still currently a
> *major*
> step backward from wp_list_pages().
>
> However, I do want to ensure that I'm supporting current functionality as
> fully as possible. So, I wrapped my nav_menu() call in a has_nav_menu()
> conditional, with an else that has my original wp_list_pages() call. That
> way,
> the user can use the default, very powerful wp_list_pages() call, or else
> can
> build his own menu using nav_menu() if he so chooses.
>
> Just thought I'd throw that out there to anyone looking for a gracefully
> degrading (upgrading?) method of incorporating nav_menu().
>
> --
> Chip Bennett
> chip at chipbennett.net
> www.chipbennett.net
>
> On Friday 16 July 2010 11:01:22 am Lance Willett wrote:
> > On Thu, Jul 15, 2010 at 6:33 PM, Edward Caissie
> >
> > <edward.caissie at gmail.com> wrote:
> > > If our options are: require, recommended, or optional ... I would lean
> > > heavily towards optional.
> > >
> > > If suggested (as noted below) is an available option I would be fine
> with
> > > that designation.
> >
> > I think the best course of action is to strongly suggest supporting
> > all customization features, with one custom menu being required (main
> > navigation).
> >
> > So something like this:
> >
> > Themes must support the the following customization feature:
> >
> > Navigation Menu - wp_nav_menu()
> > * At least one custom menu should be supported, generally the
> > top-level navigation.
> >
> > Themes are strongly suggested to support the following customization
> > features:
> >
> > Custom Header - add_custom_image_header
> > Custom Background - add_custom_background
> > Visual Editor CSS - add_editor_style
> >
> > 3.0 changes like comment_form() are required since it isn't an
> > optional customization, it's a core part of how themes work.
> >
> > -Lance
> > _______________________________________________
> > theme-reviewers mailing list
> > theme-reviewers at lists.wordpress.org
> > http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20100716/61028ff7/attachment-0001.htm>
More information about the theme-reviewers
mailing list