Created
September 18, 2019 08:55
-
-
Save shaddam/7a7792b118a3773bf87f87abec2bd7cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this code for function file | |
| // select nav menu list | |
| function select_nav_menu(){ | |
| $menus = wp_get_nav_menus(); | |
| $menulists = []; | |
| foreach( $menus as $menu ){ | |
| $menulists[ $menu->slug ] = $menu->name; | |
| } | |
| return $menulists; | |
| } | |
| // paste code where you want to show menu | |
| $args = array( | |
| 'menu' => $select_menu, | |
| 'menu_id' => 'menu-'. $id | |
| ); | |
| wp_nav_menu( $args ); | |
| // elementor control | |
| $this->add_control( | |
| 'select_menu', | |
| [ | |
| 'label' => __( 'Select Menu', 'brenda' ), | |
| 'type' => Controls_Manager::SELECT2, | |
| 'options' => select_nav_menu(), | |
| ] | |
| ); | |
| // bottom of the elementor settings display | |
| $select_menu = $settings['select_menu']; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment