Skip to content

Instantly share code, notes, and snippets.

@sumanahmed
Last active January 8, 2016 06:32
Show Gist options
  • Save sumanahmed/1a5186f84c1cd58be889 to your computer and use it in GitHub Desktop.
Save sumanahmed/1a5186f84c1cd58be889 to your computer and use it in GitHub Desktop.
add_action('init', 'theme_register_menu');
function theme_register_menu() {
if (function_exists('register_nav_menu')) {
register_nav_menu( 'theme-main-menu', __( 'Main Menu', 'brightpage' ) );
}
}
function theme_default_menu() {
echo '<ul id="dropmenu">';
if ('page' != get_option('show_on_front')) {
echo '<li><a href="'. site_url() . '/">Home</a></li>';
}
wp_list_pages('title_li=');
echo '</ul>';
}
===> paste to the ul for daynamic menu
<?php wp_nav_menu( array( 'theme_location' => 'main-menu') ); ?>
====> paste mainmenu div
<?php
if (function_exists('wp_nav_menu')) {
wp_nav_menu(array(
'theme_location' => 'theme-main-menu',
'menu_class' => 'nav',
'fallback_cb' => 'theme_default_menu'));
}
else {
wpj_default_menu();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment