当前位置: 首页>>代码示例>>PHP>>正文


PHP Walker_Nav_Menu::walk方法代码示例

本文整理汇总了PHP中Walker_Nav_Menu::walk方法的典型用法代码示例。如果您正苦于以下问题:PHP Walker_Nav_Menu::walk方法的具体用法?PHP Walker_Nav_Menu::walk怎么用?PHP Walker_Nav_Menu::walk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Walker_Nav_Menu的用法示例。


在下文中一共展示了Walker_Nav_Menu::walk方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: walk

 /**
  * pre-filters elements then calls parent::walk()
  * 
  * @filters : custom_menu_wizard_walker_items          array of filtered menu elements; array of args
  * 
  * @param array $elements Menu items
  * @param integer $max_depth
  * @return string
  */
 public function walk($elements, $max_depth)
 {
     $args = array_slice(func_get_args(), 2);
     $args = $args[0];
     if ($max_depth >= -1 && !empty($elements) && isset($args->_custom_menu_wizard)) {
         if (empty($args->_custom_menu_wizard['cmwv'])) {
             $elements = $this->_cmw_walk_legacy($args, $elements);
         } else {
             $elements = $this->_cmw_walk($args, $elements);
         }
         //since we've done all the depth filtering, set max_depth to unlimited (unless flat output was requested!)...
         if (empty($args->_custom_menu_wizard['flat_output'])) {
             $max_depth = 0;
         }
     }
     //ends the check for bad max depth, empty elements, or empty cmw args
     return empty($elements) ? '' : parent::walk(apply_filters('custom_menu_wizard_walker_items', $elements, $args), $max_depth, $args);
 }
开发者ID:EcvetStep,项目名称:ecvet-step.eu,代码行数:27,代码来源:class.walker.php

示例2: walk

 /**
  * pre-filters elements then calls parent::walk()
  *
  * @filters : custom_menu_wizard_walker_items          array of filtered menu elements; array of args
  *
  * @param array $elements Menu items
  * @param integer $max_depth
  * @return string
  */
 public function walk($elements, $max_depth)
 {
     $args = array_slice(func_get_args(), 2);
     $args = $args[0];
     if ($max_depth >= -1 && !empty($elements) && isset($args->_custom_menu_wizard)) {
         if (empty($args->_custom_menu_wizard['cmwv'])) {
             $elements = $this->_cmw_walk_legacy($args, $elements);
         } else {
             $elements = $this->_cmw_walk($args, $elements);
         }
         //since we've done all the depth filtering, set max_depth to unlimited (unless flat output was requested!)...
         if (empty($args->_custom_menu_wizard['flat_output'])) {
             $max_depth = 0;
         } else {
             //for v3.1.0 we now need to specifically reset max_depth in case we're using the alternative and it has changed
             //from hierarchic output to flat output...
             $max_depth = -1;
         }
     }
     //ends the check for bad max depth, empty elements, or empty cmw args
     return empty($elements) ? '' : parent::walk(apply_filters('custom_menu_wizard_walker_items', $elements, $args), $max_depth, $args);
 }
开发者ID:brendo10x,项目名称:site-estagio,代码行数:31,代码来源:class.walker.php

示例3: walk

 function walk($elements, $max_depth, $args)
 {
     global $post;
     // We are on a project page
     if ($post && $post->post_type == 'gp_portfolio' && is_single()) {
         // If there's a current element, then let's not do anything
         $found = $this->has_current($elements);
         if (!$found) {
             foreach ($elements as $key => $element) {
                 // Search only root items first
                 if (0 == $element->menu_item_parent) {
                     // If our current menu item is a Page with Portfolio Template
                     if ($this->is_item_portfolio_index($element)) {
                         $elements[$key]->classes[] = 'active';
                         $found = true;
                         break;
                     }
                 }
             }
             // We were unable to find Portfolio on the root, then activate any item that has
             // template-portfolio.php or template-portfolio-grid.php
             if (!$found) {
                 foreach ($elements as $key => $element) {
                     if ($this->is_item_portfolio_index($element)) {
                         $elements[$key]->classes[] = 'active';
                         break;
                     }
                 }
             }
         }
     }
     // We are on blog post page
     if ($post && $post->post_type == 'post' && is_single()) {
         $found = $this->has_current($elements);
         if (!$found) {
             foreach ($elements as $key => $element) {
                 // Search only root items first
                 if (0 == $element->menu_item_parent) {
                     if ($this->is_item_blog_index($element)) {
                         $elements[$key]->classes[] = 'active';
                         $found = true;
                         break;
                     }
                 }
             }
         }
     }
     return parent::walk($elements, $max_depth, $args);
 }
开发者ID:hungrig4leben,项目名称:my-gp,代码行数:49,代码来源:zzz__functions.php

示例4: walk

 function walk($elements, $max_depth, $r)
 {
     $this->count = count($elements);
     return parent::walk($elements, $max_depth, $r);
 }
开发者ID:rocketlift,项目名称:Rocket-Lift-Parent-Theme-for-WordPress,代码行数:5,代码来源:walkers.php


注:本文中的Walker_Nav_Menu::walk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。