admin管理员组文章数量:1130349
I cannot seem to figure out why this menu is in reversed order only for Mobile.
site-navbar.php
<div class="menu-container">
<div class="menu w-full mx-auto container xl:pr-16">
<?php
if (wp_is_mobile()) {
wp_nav_menu( array( 'menu' => 'nav' ) );
} else {
wp_nav_menu( array( 'menu' => 'nav' ) );
}
?>
</div>
</div>
nav.php
class WalkerNav extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 1, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class='sub-menu'><div id='megatron'>\n";
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent</ul></div>\n";
}
}
Basically, on the mobile layout, Pos 6 needs to be first like the desktop and needs to be at the top for Mobile. It is a single menu.
Any help would be much appreciated.
Regards,
Jake.
I cannot seem to figure out why this menu is in reversed order only for Mobile.
site-navbar.php
<div class="menu-container">
<div class="menu w-full mx-auto container xl:pr-16">
<?php
if (wp_is_mobile()) {
wp_nav_menu( array( 'menu' => 'nav' ) );
} else {
wp_nav_menu( array( 'menu' => 'nav' ) );
}
?>
</div>
</div>
nav.php
class WalkerNav extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 1, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class='sub-menu'><div id='megatron'>\n";
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent</ul></div>\n";
}
}
Basically, on the mobile layout, Pos 6 needs to be first like the desktop and needs to be at the top for Mobile. It is a single menu.
Any help would be much appreciated.
Regards,
Jake.
Share Improve this question asked Nov 6, 2018 at 2:14 HenshallHenshall 1132 silver badges12 bronze badges1 Answer
Reset to default 0It's a little bit of guessing, but...
I'm pretty sure it's just a CSS problem.
The real order of your menu items is P1, P2, P3, and so on. And thus this is the order on mobile devices.
On desktop, the order is changed, because there is float: right assigned to menu items, so they do exactly that.
The easiest way to solve it will be changing the CSS for desktop menu.
I cannot seem to figure out why this menu is in reversed order only for Mobile.
site-navbar.php
<div class="menu-container">
<div class="menu w-full mx-auto container xl:pr-16">
<?php
if (wp_is_mobile()) {
wp_nav_menu( array( 'menu' => 'nav' ) );
} else {
wp_nav_menu( array( 'menu' => 'nav' ) );
}
?>
</div>
</div>
nav.php
class WalkerNav extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 1, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class='sub-menu'><div id='megatron'>\n";
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent</ul></div>\n";
}
}
Basically, on the mobile layout, Pos 6 needs to be first like the desktop and needs to be at the top for Mobile. It is a single menu.
Any help would be much appreciated.
Regards,
Jake.
I cannot seem to figure out why this menu is in reversed order only for Mobile.
site-navbar.php
<div class="menu-container">
<div class="menu w-full mx-auto container xl:pr-16">
<?php
if (wp_is_mobile()) {
wp_nav_menu( array( 'menu' => 'nav' ) );
} else {
wp_nav_menu( array( 'menu' => 'nav' ) );
}
?>
</div>
</div>
nav.php
class WalkerNav extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 1, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class='sub-menu'><div id='megatron'>\n";
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent</ul></div>\n";
}
}
Basically, on the mobile layout, Pos 6 needs to be first like the desktop and needs to be at the top for Mobile. It is a single menu.
Any help would be much appreciated.
Regards,
Jake.
Share Improve this question asked Nov 6, 2018 at 2:14 HenshallHenshall 1132 silver badges12 bronze badges1 Answer
Reset to default 0It's a little bit of guessing, but...
I'm pretty sure it's just a CSS problem.
The real order of your menu items is P1, P2, P3, and so on. And thus this is the order on mobile devices.
On desktop, the order is changed, because there is float: right assigned to menu items, so they do exactly that.
The easiest way to solve it will be changing the CSS for desktop menu.
本文标签: theme developmentMenu is in Reversed order
版权声明:本文标题:theme development - Menu is in Reversed order 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749203233a2332139.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论