• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Walker_Nav_Menu类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: start_lvl

 /**
  * Overload Walker_Nav_Menu::start_lvl to add the 'dropdown-menu' class
  * so sub-menu items work with Bootstrap out of the box.
  */
 public function start_lvl(&$output, $depth = 0, $args = [])
 {
     parent::start_lvl($output, $depth, $args);
     $args->link_before = '';
     $args->link_after = '';
     $output = preg_replace('/sub-menu/', 'sub-menu dropdown-menu', $output);
 }
开发者ID:skemantix,项目名称:soil,代码行数:11,代码来源:nav-walker.php


示例2: end_el

 /**
  * (non-PHPdoc)
  * @see Walker_Nav_Menu::end_el()
  * @param string $output Passed by reference. Used to append additional content.
  * @param object $item Page data object.
  * @param int $depth Depth of page.
  */
 public function end_el(&$output, $item, $depth)
 {
     setup_postdata(get_post($item->object_id));
     $this->tpl->set_markup('id', 'post_' . get_the_ID())->set_markup('image', get_the_post_thumbnail(get_the_ID(), 'thumbnail'))->set_markup('permalink', get_permalink())->set_markup('title', get_the_title())->set_markup('body', get_the_excerpt());
     wp_reset_postdata();
     $output .= $this->tpl->replace_markup();
     parent::end_el(&$output, $item, $depth);
 }
开发者ID:setola,项目名称:wordpress-theme-utils-classes,代码行数:15,代码来源:ShowTitleThumbExcerptWalkerNavMenu.class.php


示例3: display_element

 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'has-dropdown';
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:littleviking61,项目名称:cigalou,代码行数:8,代码来源:library.php


示例4: display_element

 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'has_children has-children';
         wp_enqueue_style('cpotheme-fontawesome');
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:obecolette,项目名称:wordpress,代码行数:9,代码来源:class_menu.php


示例5: __construct

 function __construct($options = array())
 {
     if (method_exists('Walker_Nav_Menu', '__construct')) {
         parent::__construct();
     }
     if (is_array($options)) {
         $this->dt_options = $options;
     }
 }
开发者ID:mnjit,项目名称:aa-global,代码行数:9,代码来源:nav_menu_class.php


示例6: display_element

 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'haschild';
         $element->arrow = '<span class="menu-arrow"></span>';
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:9,代码来源:custom_menu_helper.php


示例7: display_element

 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}]) && depth == 0) {
         $element->classes[] = 'has-children';
         // Use any classname you like
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:ken-muturi,项目名称:freeassembly-wordpress-theme,代码行数:9,代码来源:sf_walker.php


示例8: start_el

 public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     if ($this->has_children) {
         $before = '<input type="checkbox" id="cb_' . $item->ID . '">' . '<label class="sub-menu-toggle" for="cb_' . $item->ID . '"><span class="fa fa-chevron-down"></span></label>';
     }
     $output .= $before . parent::start_el($output, $item, $depth, $args, $id);
 }
开发者ID:stormwild,项目名称:6cpa,代码行数:7,代码来源:walker.php


示例9: array

 function end_el(&$output, $item, $depth = 0, $args = array())
 {
     if (in_array('menu-has-children', $item->classes)) {
         $output .= '<i class="icon bonicons bi-angle-down menu-toggle"></i>';
     }
     parent::end_el($output, $item, $depth, $args);
 }
开发者ID:VadimSid,项目名称:thinkgreek,代码行数:7,代码来源:functions.php


示例10: count

 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (is_object($args[0])) {
         $args[0]->has_children = !empty($children_elements[$element->{$id_field}]);
         $args[0]->is_bordered = $element->_dfd_mega_menu_bordered == 1;
     }
     if ($depth == 0 && $element->_dfd_mega_menu_enabled == 1 && !empty($children_elements[$element->{$id_field}])) {
         $columns = $element->_dfd_mega_menu_columns;
         $cnt = count($children_elements[$element->{$id_field}]);
         if ($columns > 1 && $cnt > 1) {
             $delim_step = ceil($cnt / $columns);
             for ($i = 0; $i < $cnt; $i++) {
                 if ($i == $cnt - 1 && $cnt % $delim_step !== 0) {
                     $children_elements[$element->{$id_field}][$i]->is_mega_unlast = true;
                 }
                 if ($i == 0 || $i % $delim_step !== 0) {
                     continue;
                 }
                 $children_elements[$element->{$id_field}][$i]->is_mega_delim = true;
             }
         }
     }
     return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:25,代码来源:front_mega_menu_walker.php


示例11: array

 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     parent::start_el($output, $item, $depth, $args);
     if (!empty($item->description)) {
         $output .= sprintf('<i>%s</i>', esc_html($item->description));
     }
 }
开发者ID:rsantellan,项目名称:wordpress-ecommerce,代码行数:7,代码来源:menu.lib.php


示例12: end_el

    public function end_el(&$output, $item, $depth = 0, $args = array())
    {
        if ($depth === 0) {
            ob_start();
            ?>
			</div><!-- .columns.medium-4 -->

			<?php 
            if ($this->description) {
                ?>
				<div class="megamenu-description columns medium-8">
					<?php 
                echo do_shortcode(wpautop($this->description));
                ?>
				</div>
			<?php 
            }
            ?>
			</div><!-- .row -->
			</div><!-- .megamenu-container -->
			<?php 
            $output .= ob_get_clean();
            $this->description = false;
        }
        parent::end_el($output, $item, $depth, $args);
    }
开发者ID:JacksonCollege,项目名称:jc-theme-2015,代码行数:26,代码来源:class-jc-megamenu-walker-nav-menu.php


示例13:

 function start_el(&$output, $item, $depth, $args)
 {
     $item->title = str_repeat("-", $depth) . " " . $item->title;
     parent::start_el($output, $item, $depth, $args);
     $output = str_replace('<li', '<option value="' . $item->url . '"' . (in_array("current-menu-item", (array) $item->classes) ? ' selected="selected"' : ''), $output);
     $output = strip_tags($output, '<select>,<option>');
 }
开发者ID:DarussalamTech,项目名称:aims_prj,代码行数:7,代码来源:nav-menu-dropdown-walker.php


示例14: array

 function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $object, $depth, $args);
     $output .= $depth == 0 ? '' : '';
     $classes = empty($object->classes) ? array() : (array) $object->classes;
     // Fix dropdown menús con children - chevron
     $dropdownSections = ["nosotros", "about us"];
     foreach ($dropdownSections as $section) {
         if (in_array(str_replace(' ', '-', $section), $classes)) {
             $output .= '';
             $url = get_permalink(get_page_by_title($section)->ID);
             $replacement = "<i class=\"fa fa-chevron-down\"></i><a href=\"" . esc_url($url) . "\">" . ucfirst($section) . "</a>";
             $item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', $replacement, $item_html);
         }
     }
     //
     if (in_array('label', $classes)) {
         $output .= '';
         $item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '<label>$1</label>', $item_html);
     }
     if (in_array('divider', $classes)) {
         $item_html = preg_replace('/<a[^>]*>( .* )<\\/a>/iU', '', $item_html);
     }
     $output .= $item_html;
 }
开发者ID:Calraiser,项目名称:flux,代码行数:26,代码来源:menu-walker.php


示例15:

 /**
  * @see Walker::display_element()
  * @since 1.0.0
  *
  * @param object $element Data object
  * @param array $children_elements List of elements to continue traversing.
  * @param int $max_depth Max depth to traverse.
  * @param int $depth Depth of current element.
  * @param array $args
  * @param string $output Passed by reference. Used to append additional content.
  * @return null Null on failure with no changes to parameters.
  */
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $element->has_children = !empty($children_elements[$element->ID]);
     $element->classes[] = $element->current || $element->current_item_ancestor ? 'active' : '';
     $element->classes[] = $element->has_children ? 'has-dropdown' : '';
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:benfurfie,项目名称:genesis-foundation-6-child-theme,代码行数:19,代码来源:walker.php


示例16: isset

 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     // check whether this item has children, and set $item->hasChildren accordingly
     $element->hasChildren = isset($children_elements[$element->ID]) && !empty($children_elements[$element->ID]);
     // continue with normal behavior
     return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:aaronramirez,项目名称:ssbd,代码行数:7,代码来源:bootstrap-walker.php


示例17: array

 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $output .= $item_html;
 }
开发者ID:Stylize,项目名称:Fuel,代码行数:7,代码来源:navbar_walker.php


示例18:

 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $element->is_dropdown = !empty($children_elements[$element->ID]) && ($depth + 1 < $max_depth || $max_depth === 0);
     if ($element->is_dropdown) {
         $element->classes[] = 'dropdown';
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:riseofthetigers,项目名称:wxp-starter-theme,代码行数:8,代码来源:nav.php


示例19:

 function start_el(&$output, $item, $depth, $args)
 {
     global $framework;
     $selected = $framework->get_current_url() == $item->url ? 'selected="selected"' : '';
     $item->title = str_repeat("&nbsp;", $depth * 4) . $item->title;
     parent::start_el($output, $item, $depth, $args);
     $output = str_replace('<li', '<option ' . $selected . ' value="' . $item->url . '"', $output);
 }
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:8,代码来源:functions.php


示例20: isset

 /**
  * Traverse elements to create list from elements.
  *
  * Display one element if the element doesn't have any children otherwise,
  * display the element and its children. Will only traverse up to the max
  * depth and no ignore elements under that depth. It is possible to set the
  * max depth to include all depths, see walk() method.
  *
  * This method shouldn't be called directly, use the walk() method instead.
  *
  * @since 2.5.0
  *
  * @param object $element Data object
  * @param array $children_elements List of elements to continue traversing.
  * @param int $max_depth Max depth to traverse.
  * @param int $depth Depth of current element.
  * @param array $args
  * @param string $output Passed by reference. Used to append additional content.
  * @return null Null on failure with no changes to parameters.
  */
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     if (!$element) {
         return;
     }
     $element->hasChildren = isset($children_elements[$element->ID]) && !empty($children_elements[$element->ID]);
     return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:nikolaskarica,项目名称:bds-alliance,代码行数:28,代码来源:GummNavMenuWalker.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP WapAction类代码示例发布时间:2022-05-23
下一篇:
PHP Walker_Comment类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap