Featured in DMM v1.7
DMM = the Desk Mess Mirrored theme
Just a quick preview of one of the upcoming featured changes to the Desk Mess Mirrored theme: custom menus via the wp_nav_menu() function.
The current code for Desk Mess Mirrored version 1.6 in header.php for menus is this (cleaned up for display):
<?php if ( is_home() || is_front_page()) { ?>
<?php wp_list_pages( 'title_li=&depth=1&include=2' ); ?>
<?php wp_list_pages( 'title_li=&depth=1&exclude=2' ); ?>
<?php } else { ?>
<li><a href="<?php bloginfo( 'url' ); ?>"><?php _e( 'Home', 'desk-mess-mirrored' ) ?></a></li>
<?php wp_list_pages( 'title_li=&depth=1' ); ?>
<?php } ?>
All of that code is simply replaced by this line:
<?php dmm_nav_menu(); ?>
The function dmm_nav_menu() is referring to this section of code now found in the functions.php template file:
// 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
Notice the highlighted lines are identical which means at the default settings after updating to version 1.7 you should see no difference in how your site looks, but you are now able to set the menu links using the interface under Appearance | Menus. Also note, the menu is still set as a top-level or parent only menu. Future versions of DMM may offer drop-down menus and other options but they are not currently scheduled for a particular release date or version at this time.
All of these changes were based on the article I wrote at WPFirstAid.com titled: Upgrade wp_list_pages() to wp_nav_menu().
Enjoy!
© 2010, Edward Caissie. All rights reserved.
- Share this:
- Share
Related posts:
- Hide a Menu Page
- Desk Mess Mirrored 1.9
- BNS Featured Category 1.8.1
- Desk Mess Mirrored 1.5
- Desk Mess Mirrored 1.6
Tags: custom menu, desk mess mirrored, update, WPFirstAid
< 140
I am Cais: WordPress junkie and blogger; maker of fine themes and plugins; WP Theme Review Team admin; Guitar player; and, mischief managerWhite Knucklin’
We are running a beta version of WordPress!
Twitter Follow Button
Follow @JellyBeenSearch
Buy me a coffee?
... or grant an Amazon wishBuy them a coffee?
US Poker Sites
See this list of US poker sites at pokernewsreport.comLooking for Bingo Reviews?
Ante Up?
Visit onlinepoker.net, a complete guide to playing USA poker, online poker in the UK and globally.Need a Host?
a la Carte
Categories
- Contributed (1)
- CSS (6)
- News (118)
- Promoted (2)
- Showcases (4)
- Uncategorized (2)
- WordPress (130)
WordPress
Category: WordPress
Category: Showcases
Tag: Update
We’re Back!It seems we ran into a bit of a over-usage issue with our web host thanks to what appears to have been an overzealous search bot. We have made corrections to the site and do not expect to see a repeat performance (at least not for this particular issue). Thank your for your patronage and [...]
NoNa 1.5NoNa version 1.5 has been submitted to WordPress for review (and approval) into the Extend Theme repository as of April 24, 2012.
Shades 1.8Shades version 1.8 is now available at the WordPress Extend Themes repository as of April 20, 2012
Archives
- May 2012 (1)
- April 2012 (5)
- March 2012 (2)
- February 2012 (1)
- January 2012 (1)
- December 2011 (3)
- November 2011 (6)
- October 2011 (2)
- September 2011 (3)
- August 2011 (1)
- July 2011 (5)
- June 2011 (2)
- May 2011 (4)
- April 2011 (1)
- March 2011 (3)
- February 2011 (2)
- January 2011 (1)
- December 2010 (3)
- November 2010 (1)
- October 2010 (2)
- September 2010 (4)
- August 2010 (2)
- July 2010 (2)
- June 2010 (3)
- May 2010 (1)
- April 2010 (8)
- March 2010 (2)
- February 2010 (7)
- January 2010 (5)
- December 2009 (5)
- November 2009 (9)
- October 2009 (6)
- September 2009 (11)
- August 2009 (13)
- July 2009 (7)
- June 2009 (8)
- May 2009 (4)






5 Comments
@Yamasha – Look for them to be better implemented in DMMv1.7; in the mean time you should be able to add this snippet of code right before the_content() in ‘index.php’ to add them right now:
<?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'thumbnail', array( 'class' => 'alignleft' ) ); } ?>@Yamasha – I took a quick look using DMMv1.7 and the plugin appears to work. I would suggest waiting for version 1.7 to be released in the WordPress Themes repository.
@Yamasha – The new version has already been released, it is just waiting for its turn in the review queue at the WordPress.org repository.
Hi, I have a big problem with the theme I can’t make my navigation top menu to show only the root pages… I tried everything like adding depth parameter to the functions.php and it is still not working… When I enter a product the navigation gets bigger
@Gencho – The most likely solution is probably creating a custom menu; by default, the theme will add every new page to the top menu via the call to `wp_list_pages`