我想打印一个父菜单的半个子菜单 [英] I want to print half submenu of a parent menu out of total
本文介绍了我想打印一个父菜单的半个子菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello World,我从管理员调用菜单栏,我想要父菜单的打印子菜单,我有20个子菜单,但我想在父菜单上打印10个子菜单。代码在这里...
<?php
$ defaults = array(
' theme_location' => ' ',
' menu' => ' menu' ,
' container' => ' div',
' container_class' => ' ',
' container_id' => ' ',
' menu_class' => ' menu',
' menu_id' => ' ',
' echo' => true,
' fallback_cb' => ' wp_page_menu',
' 在' =>之前' ',
' 在' =>之后' ',
' link_before' => ' ',
' link_after' => ' ',
' items_wrap' => ' < ul id =%1 $ sclass =%2 $ s>%3 $ s< ; / ul>',
' depth' => 0,
' walker' => ' '
);
wp_nav_menu( $ defaults );
?>
解决方案
默认值 =数组(
' theme_location' => ' ',
' menu' => ' menu',
' container' => ' < span class =code-string> div',
' container_class' => ' ',
' container_id' => ' ',
' menu_class' => ' menu',
' menu_id' => ' ',
' echo' => true,
' fallback_cb' => ' wp_page_menu',
' 在' =>之前' ',
' 在' =>之后' ',
' link_before' => ' ',
' link_after' => ' ',
' items_wrap' => ' < ul id =%1
sclass =% 2
的>%3
Hello World, I called menu bar from admin, I want print sub-menu of a parent menu, I have total 20 sub-menu but I wanna print 10 sub-menu on parent menu hover. Code here...
<?php
$defaults = array(
'theme_location' => '',
'menu' => 'menu',
'container' => 'div',
'container_class' => '',
'container_id' => '',
'menu_class' => 'menu',
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'depth' => 0,
'walker' => ''
);
wp_nav_menu( $defaults );
?>
解决方案
defaults = array( 'theme_location' => '', 'menu' => 'menu', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1
s" class="%2
s">%3
这篇关于我想打印一个父菜单的半个子菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文