Skip to content

Instantly share code, notes, and snippets.

@renemorozowich
Last active May 25, 2019 21:17
Show Gist options
  • Save renemorozowich/7459bf6e8a0814f132b36a5b17a35390 to your computer and use it in GitHub Desktop.
Save renemorozowich/7459bf6e8a0814f132b36a5b17a35390 to your computer and use it in GitHub Desktop.
Add a top menu to an Astra child theme
/**
* Add additional menu
*/
function register_additional_menus() {
register_nav_menu( 'top-menu', __( 'Top Menu' ) );
}
add_action( 'init', 'register_additional_menus' );
/**
* Add scripts to astra_header_before
*/
function add_script_before_header() {
?>
<div class="top-header-bar">
<div class="ast-container">
<?php wp_nav_menu( array( 'theme_location' => 'top-menu' ) ); ?>
</div>
</div>
<?php
}
add_action( 'astra_header_before', 'add_script_before_header' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment