mwdelaney/sage-wp-nav-submenu 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mwdelaney/sage-wp-nav-submenu

Composer 安装命令:

composer require mwdelaney/sage-wp-nav-submenu

包简介

Get submenu items from a WordPress menu based on parent or sibling

README 文档

README

This package is based entirely on this code from levymetal.

The instructions below are also taken from levymetal's excellent documentation.

To install, run the following in your Sage9-based theme directory:

composer require "mwdelaney/sage-wp-nav-submenu"

Include the submenu arguemnts in your wp_nav_menu function:

wp_nav_menu( array(
  'menu'     => 'Menu Name',
  ...
  'sub_menu' => true
) );

By default, if you have many nested levels, this code will filter the menu by the absolute top level parent. If you want the menu to drill down dynamically by filtering the menu based on the direct parent, pass a "direct_parent" => true parameter to the wp_nav_menu call.

wp_nav_menu( array(
  'menu'          => 'Menu Name',
  ...
  'sub_menu'      => true,
  'direct_parent' => true
) );

If you want to include the parent/root element in the menu, you can pass in a "show_parent" => true parameter to display the root level item.

wp_nav_menu( array(
  'menu'        => 'Menu Name',
  ...
  'sub_menu'    => true,
  'show_parent' => true
) );

If you want to include the parent/root element in the menu even if it has no children, you can pass in a "show_parent_only" => true parameter to display the root level item.

wp_nav_menu( array(
  'menu'        => 'Menu Name',
  ...
  'sub_menu'    => true,
  'show_parent' => true,
  'show_parent_only' => true
) );

Of course, you can continue to use the standard wp_nav_menu parameters as well. For example, if you want to limit the number of nested children being displayed, you can use the depth parameter. Or of you don’t want the menu to be displayed, you can use the echo parameter.

统计信息

  • 总下载量: 5.56k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固