$ctx
*/
function aksrt_nav_mobile_shell(array $ctx): void {
$align = (string) ($ctx['mobile_align'] ?? 'left');
if (!in_array($align, ['top', 'left', 'right'], true)) {
$align = 'left';
}
$m_layout = (string) ($ctx['mobile_layout'] ?? 'center');
$fixed = !empty($ctx['fixed']);
$touch_attr = '';
if ($align !== 'top') {
// mini-touch.js reads data-mini-touch; direction via data-touch-direction.
$touch_attr = ' data-mini-touch="mobile-nav" data-touch-direction="' . esc_attr($align) . '"';
}
echo '
';
}
endif;
if (!function_exists('aksrt_nav_mobile_content')) :
/**
* Mobile menu list + top toggles + user box.
*
* @param array $ctx
* @param string $m_layout center|left
*/
function aksrt_nav_mobile_content(array $ctx, string $m_layout = 'center'): void {
$top_btns = '';
if (in_array('m_menu', (array) ($ctx['theme_positions'] ?? []), true)) {
$top_btns .= '';
$top_btns .= '';
$top_btns .= '';
$top_btns .= '';
}
if ($m_layout !== 'center' && !empty($ctx['search_enabled'])) {
$top_btns .= '';
}
if (function_exists('aksrt_get_translate_language_btn')) {
$top_btns .= aksrt_get_translate_language_btn('pull-right');
}
if ($top_btns !== '') {
echo '' . $top_btns . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
$location = has_nav_menu('mobile') ? 'mobile' : 'primary';
$walker = class_exists('\AKSRT\Frontend\NavWalker')
? new \AKSRT\Frontend\NavWalker(
function_exists('aksrt_get_menu_decoration_settings')
? aksrt_get_menu_decoration_settings()
: []
)
: null;
$args = [
'container' => false,
'echo' => false,
'fallback_cb' => false,
'depth' => 2,
'items_wrap' => '',
'theme_location' => $location,
];
if ($walker) {
$args['walker'] = $walker;
}
$menu = has_nav_menu($location) ? (string) wp_nav_menu($args) : '';
if ($menu === '' && $location !== 'primary' && has_nav_menu('primary')) {
$args['theme_location'] = 'primary';
$menu = (string) wp_nav_menu($args);
}
if ($menu === '' && is_super_admin()) {
$menu = '';
}
echo $menu; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
if (is_singular('post')) {
echo '';
}
// User box at bottom of drawer.
if (!empty($ctx['user_menu'])) {
echo aksrt_header_user_box_html($ctx); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
endif;