2021-04-27 22:21:26 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Register Menus
|
|
|
|
*
|
|
|
|
* @link http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
|
2021-04-28 01:20:47 +02:00
|
|
|
* @package arcHIVE-theme
|
|
|
|
* @since arcHIVE-theme 1.0.0
|
2021-04-27 22:21:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
register_nav_menus(
|
|
|
|
array(
|
|
|
|
'top-bar-r' => esc_html__( 'Right Top Bar', 'foundationpress' ),
|
2021-04-30 01:12:57 +02:00
|
|
|
// 'mobile-nav' => esc_html__( 'Mobile', 'foundationpress' ),
|
2021-04-29 11:47:25 +02:00
|
|
|
'home-hero-bar' => esc_html__( 'Home Hero bar', 'foundationpress' ),
|
2021-04-27 22:21:26 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-29 11:47:25 +02:00
|
|
|
* Desktop navigation - Top bar right navigation
|
2021-04-27 22:21:26 +02:00
|
|
|
*
|
|
|
|
* @link http://codex.wordpress.org/Function_Reference/wp_nav_menu
|
|
|
|
*/
|
|
|
|
if ( ! function_exists( 'foundationpress_top_bar_r' ) ) {
|
|
|
|
function foundationpress_top_bar_r() {
|
|
|
|
wp_nav_menu(
|
|
|
|
array(
|
|
|
|
'container' => false,
|
2021-04-29 00:56:02 +02:00
|
|
|
'menu_class' => 'menu',
|
|
|
|
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
|
2021-04-27 22:21:26 +02:00
|
|
|
'theme_location' => 'top-bar-r',
|
|
|
|
'depth' => 3,
|
|
|
|
'fallback_cb' => false,
|
|
|
|
'walker' => new Foundationpress_Top_Bar_Walker(),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mobile navigation - topbar (default) or offcanvas
|
|
|
|
*/
|
2021-04-29 00:56:02 +02:00
|
|
|
//if ( ! function_exists( 'foundationpress_mobile_nav' ) ) {
|
|
|
|
// function foundationpress_mobile_nav() {
|
|
|
|
// wp_nav_menu(
|
|
|
|
// array(
|
|
|
|
// 'container' => false, // Remove nav container
|
|
|
|
// 'menu' => __( 'mobile-nav', 'foundationpress' ),
|
|
|
|
// 'menu_class' => 'vertical menu',
|
|
|
|
// 'theme_location' => 'mobile-nav',
|
|
|
|
// 'items_wrap' => '<ul id="%1$s" class="%2$s" data-accordion-menu data-submenu-toggle="true">%3$s</ul>',
|
|
|
|
// 'fallback_cb' => false,
|
|
|
|
// 'walker' => new Foundationpress_Mobile_Walker(),
|
|
|
|
// )
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
2021-04-27 22:21:26 +02:00
|
|
|
|
|
|
|
|
2021-04-29 11:47:25 +02:00
|
|
|
/**
|
|
|
|
* Desktop navigation - Home Hero bottom bar
|
|
|
|
*
|
|
|
|
* @link http://codex.wordpress.org/Function_Reference/wp_nav_menu
|
|
|
|
*/
|
|
|
|
if ( ! function_exists( 'foundationpress_home_hero_bar' ) ) {
|
|
|
|
function foundationpress_home_hero_bar() {
|
|
|
|
wp_nav_menu(
|
|
|
|
array(
|
|
|
|
'container' => false,
|
2021-04-30 01:12:57 +02:00
|
|
|
'menu_class' => 'menu button hollow',
|
2021-04-29 11:47:25 +02:00
|
|
|
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
|
|
|
|
'theme_location' => 'home-hero-bar',
|
|
|
|
'depth' => 3,
|
|
|
|
'fallback_cb' => false,
|
|
|
|
'walker' => new Foundationpress_Home_Hero_Bar_Walker(),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-04-27 22:21:26 +02:00
|
|
|
/**
|
|
|
|
* Add support for buttons in the top-bar menu:
|
|
|
|
* 1) In WordPress admin, go to Apperance -> Menus.
|
|
|
|
* 2) Click 'Screen Options' from the top panel and enable 'CSS CLasses' and 'Link Relationship (XFN)'
|
|
|
|
* 3) On your menu item, type 'has-form' in the CSS-classes field. Type 'button' in the XFN field
|
|
|
|
* 4) Save Menu. Your menu item will now appear as a button in your top-menu
|
|
|
|
*/
|
|
|
|
if ( ! function_exists( 'foundationpress_add_menuclass' ) ) {
|
|
|
|
function foundationpress_add_menuclass( $ulclass ) {
|
|
|
|
$find = array( '/<a rel="button"/', '/<a title=".*?" rel="button"/' );
|
|
|
|
$replace = array( '<a rel="button" class="button"', '<a rel="button" class="button"' );
|
|
|
|
|
|
|
|
return preg_replace( $find, $replace, $ulclass, 1 );
|
|
|
|
}
|
|
|
|
add_filter( 'wp_nav_menu', 'foundationpress_add_menuclass' );
|
|
|
|
}
|