class-kubio-menu-wallker.php
4 years ago
class-wp-rest-menu-locations-controller.php
4 years ago
class-wp-rest-menus-controller.php
4 years ago
index.php
3 years ago
locations.php
4 years ago
menu-rest-controller.php
3 years ago
locations.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | function kubio_register_menus_locations() { |
| 4 | $current_locations = array_keys( get_registered_nav_menus() ); |
| 5 | |
| 6 | $kubio_locations = apply_filters( |
| 7 | 'kubio_menus_locations', |
| 8 | array( |
| 9 | 'header-menu' => kubio_theme_has_kubio_block_support() |
| 10 | ? esc_html__( 'Header menu', 'kubio' ) |
| 11 | : esc_html__( 'Kubio header menu', 'kubio' ), |
| 12 | |
| 13 | 'header-menu-secondary' => kubio_theme_has_kubio_block_support() |
| 14 | ? esc_html__( 'Secondary header menu', 'kubio' ) |
| 15 | : esc_html__( 'Kubio secondary header menu', 'kubio' ), |
| 16 | |
| 17 | 'footer-menu' => kubio_theme_has_kubio_block_support() |
| 18 | ? esc_html__( 'Footer menu', 'kubio' ) |
| 19 | : esc_html__( 'Kubio footer menu', 'kubio' ), |
| 20 | |
| 21 | 'footer-menu-secondary' => kubio_theme_has_kubio_block_support() |
| 22 | ? esc_html__( 'Secondary footer menu', 'kubio' ) |
| 23 | : esc_html__( 'Kubio secondary footer menu', 'kubio' ), |
| 24 | ) |
| 25 | ); |
| 26 | |
| 27 | foreach ( $kubio_locations as $location => $title ) { |
| 28 | if ( in_array( $location, $current_locations ) ) { |
| 29 | unset( $kubio_locations[ $location ] ); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | register_nav_menus( $kubio_locations ); |
| 34 | } |
| 35 | |
| 36 | add_action( 'after_setup_theme', 'kubio_register_menus_locations', 100 ); |
| 37 |