コード例 #1
1
ファイル: walker.php プロジェクト: stormwild/6cpa
 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);
 }
コード例 #2
1
ファイル: functions.php プロジェクト: VadimSid/thinkgreek
 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);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 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));
     }
 }
コード例 #5
0
ファイル: nav-walker.php プロジェクト: skemantix/soil
 /**
  * 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);
 }
    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);
    }
コード例 #7
0
 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>');
 }
コード例 #8
0
ファイル: menu-walker.php プロジェクト: Calraiser/flux
 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;
 }
コード例 #9
0
 /**
  * @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);
 }
コード例 #10
0
 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);
 }
コード例 #11
0
ファイル: navbar_walker.php プロジェクト: Stylize/Fuel
 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;
 }
 /**
  * (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);
 }
コード例 #13
0
 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);
 }
コード例 #14
0
ファイル: functions.php プロジェクト: KurtMakesWeb/CandG
 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);
 }
コード例 #15
0
ファイル: library.php プロジェクト: littleviking61/cigalou
 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);
 }
コード例 #16
0
 /**
  * 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);
 }
コード例 #17
0
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     //we add a property here
     //will be used in override start_el() and class filter
     $element->is_dropdown = !empty($children_elements[$element->ID]);
     //let the parent do the rest of the job !
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
コード例 #18
0
ファイル: functions.php プロジェクト: JalpMi/v2contact
 public function display_element($el, &$children, $max_depth, $depth = 0, $args, &$output)
 {
     $id = $this->db_fields['id'];
     if (isset($children[$el->{$id}])) {
         $el->classes[] = 'has_children';
     }
     parent::display_element($el, $children, $max_depth, $depth, $args, $output);
 }
コード例 #19
0
ファイル: menus.php プロジェクト: h3rodev/sometheme
 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[] = 'menu-parent-item';
         //enter any classname you like here!
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
コード例 #20
0
ファイル: class_menu.php プロジェクト: obecolette/wordpress
 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);
 }
コード例 #21
0
ファイル: nav_menu_class.php プロジェクト: mnjit/aa-global
 function __construct($options = array())
 {
     if (method_exists('Walker_Nav_Menu', '__construct')) {
         parent::__construct();
     }
     if (is_array($options)) {
         $this->dt_options = $options;
     }
 }
コード例 #22
0
 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);
 }
コード例 #23
0
 function end_el(&$output, $item, $depth, $args)
 {
     if (!$args->dropdown) {
         parent::end_el($output, $item, $depth, $args);
     } else {
         $output .= "</option>\n";
     }
     // replace closing </li> with the option tag
 }
コード例 #24
0
 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);
 }
コード例 #25
0
 /**
  * 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.
  *
  * This method shouldn't be called directly, use the walk() method instead.
  *
  * @see Walker::start_el()
  * @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.
  */
 public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
 {
     if (!$element) {
         return;
     }
     $id_field = $this->db_fields['id'];
     $this->has_children = !empty($children_elements[$element->{$id_field}]);
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
コード例 #26
0
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     //we add a property here
     //will be used in override start_el() and class filter
     $element->is_dropdown = !empty($children_elements[$element->ID]);
     $element->classes = apply_filters('tc_nav_menu_css_class', array_filter(empty($element->classes) ? array() : (array) $element->classes), $element, $args, $depth);
     //let the parent do the rest of the job !
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
コード例 #27
0
 public function start_el(&$output, $item, $depth, $args)
 {
     // add spacing to the title based on the current depth
     $item->title = esc_attr($item->title);
     // call the prototype and replace the <li> tag
     // from the generated markup...
     parent::start_el(&$output, $item, $depth, $args);
     $output .= '	<option value="' . $item->url . '">' . $item->title;
 }
コード例 #28
0
 function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $object, $depth, $args);
     $classes = empty($object->classes) ? array() : (array) $object->classes;
     if (in_array('label', $classes)) {
         $item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '<label>$1</label>', $item_html);
     }
     $output .= $item_html;
 }
コード例 #29
-1
ファイル: Walker_nav_menu.php プロジェクト: alispx/calibrefx
 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}]);
     }
     return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
コード例 #30
-1
 function end_el(&$output, $item, $depth = 0, $args = array())
 {
     $output .= apply_filters('walker_nav_menu_end_el', '', $item, $depth, $args);
     if ($args->mega_wrapper_end && $depth == 0) {
         $output .= $args->mega_wrapper_end;
     }
     parent::end_el($output, $item, $depth, $args);
 }