$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';
}
$touch_attr = '';
if ($align !== 'top') {
$touch_attr = ' mini-touch="mobile-nav" touch-direction="' . esc_attr($align) . '"';
}
echo '
';
}
endif;
if (!function_exists('aksrt_nav_mobile_content')) :
/**
* Mobile menu list + top toggles + user box.
*
* @param array $ctx
*/
function aksrt_nav_mobile_content(array $ctx): void {
$top_btns = '';
if (in_array('m_menu', (array) ($ctx['theme_positions'] ?? []), true)) {
$top_btns .= '';
$top_btns .= '';
$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()
: 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')) {
$page = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_post_page_settings()
: [];
$article_nav = !isset($page['article_nav']) || !empty($page['article_nav']);
$article_nav_mobile = !isset($page['article_nav_mobile']) || !empty($page['article_nav_mobile']);
if ($article_nav && $article_nav_mobile) {
echo '';
}
}
// User box at bottom of drawer.
echo aksrt_header_user_box_html($ctx); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
endif;