menu_id = array_merge( $menu_id );
add_action( 'after_setup_theme', [ $this, 'register' ] );
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue' ] );
}
/**
* Register Custom Menus
*/
public function register() {
foreach ( $this->menu_id as $key => $value ) {
$this->create( $value, $key );
}
}
/**
* Create Menus
*
* @param string $name outputs name.
* @param string $id output id.
*/
public function create( $name, $id ) {
$args = [
$id => $name,
];
register_nav_menus( $args );
}
public function enqueue() {
/**
* We will be enqueue the app.js file, which mainly be for the navigation only.
*/
wp_enqueue_script( 'backdrop-core-navigation', get_theme_file_uri( 'vendor/benlumia007/backdrop-core/assets/js/navigation.js' ), array('jquery'), '1.0.0', true );
wp_localize_script( 'backdrop-core-navigation', 'backdropCoreScreenReaderText', array(
'expand' => '' . esc_html__( 'expand child menu', 'backdrop-core' ) . '',
'collapse' => '' . esc_html__( 'collapse child menu', 'backdrop-core' ) . '',
) );
}
}