So I have a nice little Sub Nav Walker up and running that I have added to a navfunctions.php file which gets called from my main theme functions.php.
In my sidebar I then call a file subnav.php which executes the subnav walker:
relevant sidebar snippet:
<?php
load_template(TEMPLATEPATH . '/subnav.php');
?>
subnav.php contents
wp_nav_menu( array(
'container' =>false,
'theme_location' => 'Main Navigation',
'sort_column' => 'menu_order',
'menu_class' => 'tfsubmenu',
'echo' => true,
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'depth' => 0,
'walker' => new subnav_walker()
) );
The subnav_walker is perfect so no issues there.
The issue I have is that I'd ideally like to not execute the load_template call if there are no child menu items on the current page.
Is there a way I could wrap the load_template call in an if statement without calling the subnav walker?
e.g. something like:
<?php
if (!empty (wp_menu_menu_children)) {
load_template(TEMPLATEPATH . '/subnav.php');
}
?>
I realise this is a long shot but any ideas would be a big help.
Thanks,
Ed