Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-------------------------------------------------------------------------------------------------------------------------->
- //This code have to use in functions.php to registered menu
- /******This code for registration for wp menu**********/
- function wpj_register_menu() {
- if (function_exists('register_nav_menu')) {
- register_nav_menu( 'top_main_menu', __( 'Main Menu', 'brightpage' ) ); // Here (wpj-main-menu) is unique id & Main Menu is display name
- // Registared Another Menu
- }
- }
- add_action('init', 'wpj_register_menu');
- <!---------------------------------------------------------------------------------------------------------------------------->
- <!------------------------------------------------------------------------------------------------------------------------->
- //This code have to use instead of ul li
- <?php
- if (function_exists('wp_nav_menu')) {
- wp_nav_menu(array(
- 'theme_location' => 'top_main_menu', // this id from functions.php
- 'menu' => '',
- 'container' => 'div',
- 'container_class' => '', // this class is of before <ul> that is class of div
- 'container_id' => '', // this id is of before <ul> that is id of div
- 'menu_class' => 'menu', // this class is of <ul></ul>
- 'menu_id' => '', // this id is of <ul></ul>
- 'echo' => true,
- 'fallback_cb' => 'wp_page_menu',
- 'before' => '',
- 'after' => '',
- 'link_before' => '',
- 'link_after' => '',
- 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
- 'depth' => 0,
- 'walker' => ''
- ));
- }
- else {
- wpj_default_menu();
- }
- ?>
- <!------------------------------------------------------------------------------------------------------------------------->
- This is wordpress source link:https://codex.wordpress.org/Function_Reference/wp_nav_menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement