File: /home/clinicamaciel/www/index/wp-content/themes/bedentist/inc/template-menu.php
<?php
/**
* Menu Template Functions.
*
* @package Be_Dentist
*/
/**
* Show main menu.
*
* @since 1.0.0
* @return void
*/
function be_dentist_main_menu() { ?>
<nav id="site-navigation" class="main-navigation" role="navigation">
<button class="menu-toggle" aria-controls="main-menu" aria-expanded="false"><i class="material-icons">subject</i></button>
<?php
$args = apply_filters( 'be_dentist_main_menu_args', array(
'theme_location' => 'main',
'container' => '',
'menu_id' => 'main-menu',
'fallback_cb' => 'be_dentist_set_nav_menu',
'fallback_message' => esc_html__( 'Set main menu', 'be_dentist' ),
) );
wp_nav_menu( $args );
?>
</nav><!-- #site-navigation -->
<?php
}
/**
* Show footer menu.
*
* @since 1.0.0
* @return void
*/
function be_dentist_footer_menu() { ?>
<nav id="footer-navigation" class="footer-menu" role="navigation">
<?php
$args = apply_filters( 'be_dentist_footer_menu_args', array(
'theme_location' => 'footer',
'container' => '',
'menu_id' => 'footer-menu-items',
'menu_class' => 'footer-menu__items inline-list',
'depth' => 1,
'fallback_cb' => '__return_empty_string',
'fallback_message' => esc_html__( 'Set footer menu', 'be_dentist' ),
) );
wp_nav_menu( $args );
?>
</nav><!-- #footer-navigation -->
<?php
}
/**
* Show top page menu if active.
*
* @since 1.0.0
* @return void
*/
function be_dentist_top_menu() {
if ( ! has_nav_menu( 'top' ) ) {
return;
}
wp_nav_menu( array(
'theme_location' => 'top',
'container' => 'div',
'container_class' => 'top-panel__menu',
'menu_class' => 'top-panel__menu-list',
'depth' => 1,
) );
}
/**
* Get social nav menu.
*
* @since 1.0.0
* @return string
*/
/**
* Get social nav menu.
*
* @since 1.0.0
* @since 1.0.0 Added new param - $item.
* @param string $context Current post context - 'single' or 'loop'.
* @param string $type Content type - icon, text or both.
* @return string
*/
function be_dentist_get_social_list( $context, $type = 'icon' ) {
static $instance = 0;
$instance++;
$container_class = array( 'social-list' );
if ( ! empty( $context ) ) {
$container_class[] = sprintf( 'social-list--%s', sanitize_html_class( $context ) );
}
$container_class[] = sprintf( 'social-list--%s', sanitize_html_class( $type ) );
$args = apply_filters( 'be_dentist_social_list_args', array(
'theme_location' => 'social',
'container' => 'div',
'container_class' => join( ' ', $container_class ),
'menu_id' => "social-list-{$instance}",
'menu_class' => 'social-list__items inline-list',
'depth' => 1,
'link_before' => ( 'icon' == $type ) ? '<span class="screen-reader-text">' : '',
'link_after' => ( 'icon' == $type ) ? '</span>' : '',
'echo' => false,
'fallback_cb' => 'be_dentist_set_nav_menu',
'fallback_message' => esc_html__( 'Set social menu', 'be_dentist' ),
) );
return wp_nav_menu( $args );
}
/**
* Set fallback callback for nav menu.
*
* @param array $args Nav menu arguments.
* @return void
*/
function be_dentist_set_nav_menu( $args ) {
if ( ! current_user_can( 'edit_theme_options' ) ) {
return null;
}
$format = '<div class="set-menu %3$s"><a href="%2$s" target="_BeDENTIST" class="set-menu_link">%1$s</a></div>';
$label = $args['fallback_message'];
$url = esc_url( admin_url( 'nav-menus.php' ) );
printf( $format, $label, $url, $args['container_class'] );
}