Hi there,
Thanks for having a look at my question. I have built a site for my charity (see www.youthheroes.org.uk) and I want to display a different menu depending on the the location of the project we are working on. I have managed to get close to what I want using the following code which calls a Wordpress menu🙂:
<?php if ( get_post_meta($post->ID, 'main', true) ) { ?>
<?php do_action('wp_menubar','Main Menu'); ?>
<?php } ?>
<?php if ( get_post_meta($post->ID, 'wirral', true) ) { ?>
<?php do_action('wp_menubar','Main Menu'); ?>
<?php } ?>
<?php if ( get_post_meta($post->ID, 'salford', true) ) { ?>
<?php do_action('wp_menubar','Salford'); ?>
<?php } ?>
However, I would like to include a catch all and tidy up the code a bit to make expansion easier. I have this code below but it's incorrect and returns an error😕:
<?php if ( get_post_meta($post->ID, 'salford', true) ) { ?>
<?php do_action('wp_menubar','salford'); ?>
<?php elseif ( get_post_meta($post->ID, 'wirral', true) ) ?>
<?php do_action('wp_menubar','wirral'); ?>
<?php else ?>
<?php do_action('wp_menubar','Main Menu'); } ?>
Any help much appreciated.
Thanks,
Martin