示例#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
0
 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;
 }
 function start_el(&$output, $item, $depth = 2, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     $item_html = apply_filters('stachestack_wp_nav_menu_item', $item_html);
     $output .= $item_html;
 }
 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));
     }
 }
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     if (0 == $depth) {
         return;
     }
     parent::start_el($output, $item, $depth, $args);
 }
示例#6
0
 /**
  * @see Walker_Nav_Menu::start_el()
  * @since 1.0.0
  *
  * @param string $output Passed by reference. Used to append additional content.
  * @param object $object
  * @param int $depth Depth of menu item. Used for padding.
  * @param array|object $args
  * @param int $current_object_id
  * @internal param object $item Menu item data object.
  */
 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;
     //		FB::info($item_html, '$item_html');
     /*	$output .= ($depth == 0) ? '<li class="divider"></li>' : '';
     
     
     		$classes[] = 'menu-item-' . $object->ID;
     		$classes[] = ($depth == 0) ? 'title' : '';
     		$classes[] = (in_array('current-menu-item', $classes) && !in_array('active', $classes)) ? 'active' : '';
     
     
     		$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $object, $args));
     
     
     		$class_names = $class_names ? 'class="' . esc_attr($class_names) . '"' : '';*/
     //FB::info($object,'$object');
     if (in_array('label', $classes)) {
         $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);
     }
     //		$indent = ($depth) ? str_repeat("\t", $depth) : '';
     //		$output .= $indent . '<li id="menu-item-' . $object->ID . ' " ng-class="$location.path()
     //		" ' . $class_names . '>';
     $output .= $item_html;
     //		parent::start_el($output, $object, $depth, $args);
     //		FB::info($output, ' $output');
 }
      function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
        $item_html = '';
        parent::start_el( $item_html, $item, $depth, $args);

        if ( $item->is_dropdown ) {
          //makes top menu not clickable (default bootstrap behaviour)
          $search         = '<a';
          $replace        = ( ! wp_is_mobile() && 'hover' == esc_attr( TC_utils::$inst->tc_opt( 'tc_menu_type' ) ) ) ? $search : '<a class="dropdown-toggle" data-toggle="dropdown" data-target="#"';
          $replace       .= strpos($item_html, 'href=') ? '' : ' href="#"' ;
          $replace        = apply_filters( 'tc_menu_open_on_click', $replace , $search );
          $item_html      = str_replace( $search , $replace , $item_html);

          //adds arrows down
          if ( $depth === 0 )
              $item_html      = str_replace( '</a>' , ' <b class="caret"></b></a>' , $item_html);
        }
        elseif (stristr( $item_html, 'li class="divider' )) {
          $item_html = preg_replace( '/<a[^>]*>.*?<\/a>/iU' , '' , $item_html);
        }
        elseif (stristr( $item_html, 'li class="nav-header' )) {
          $item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU' , '$1' , $item_html);
        }

        $output .= $item_html;
      }
示例#8
0
 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;
 }
 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>');
 }
示例#10
0
 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);
 }
示例#11
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if ($item->is_dropdown) {
         $item_html = str_replace('</a>', '</a> <button class="sub-menu-unfold" aria-expanded="false"><span>' . __("Unfold Sub-Menu", "from-scratch") . '</span></button>', $item_html);
     }
     $output .= $item_html;
 }
 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;
 }
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if ($item->is_dropdown && $depth === 0) {
         $item_html = str_replace('<a', '<a ' . display_control(), $item_html);
         $item_html = str_replace('</a>', ' <b class="caret"></b></a>', $item_html);
     }
     $output .= $item_html;
 }
 function start_el(&$output, $item, $depth, $args)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     if (in_array('section', $classes)) {
         $item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '<label>$1</label>', $item_html);
     }
     $output .= $item_html;
 }
示例#15
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if ($item->is_dropdown && $depth === 0) {
         $item_html = str_replace('<a', '<a class="dropdown-toggle"', $item_html);
     }
     $item_html = apply_filters('erh_wp_nav_menu_item', $item_html);
     $output .= $item_html;
 }
示例#16
0
 function start_el(&$output, $item, $depth, $args)
 {
     if ($depth == 0) {
         $parent_id = $item->menu_item_parent;
         if ($parent_id != 0) {
             return;
         }
     }
     parent::start_el($output, $item, $depth, $args);
 }
 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;
 }
示例#18
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if ($item->is_dropdown && $depth === 0) {
         $item_html = str_replace('<a', '<a class="scroll"', $item_html);
         $item_html = str_replace('</a>', ' <b data-toggle="dropdown"></b></a>', $item_html);
     }
     $output .= $item_html;
 }
示例#19
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if ($item->hasChildren && $depth === 0) {
         $item_html = str_replace('<a', '<a class="dropdown-toggle" data-toggle="dropdown" data-target="#"', $item_html);
         $item_html = str_replace('</a>', ' <b class="caret"></b></a>', $item_html);
     }
     $output .= $item_html;
 }
 /**
  * Adjust markup for top level dropdown menu item.
  */
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if ($item->is_dropdown && 0 === $depth) {
         $item_html = str_replace('<a', '<a class="dropdown-toggle" data-toggle="dropdown"', $item_html);
         $item_html = str_replace('</a>', ' <b class="caret"></b></a>', $item_html);
         $item_html = str_replace(esc_attr($item->url), '#', $item_html);
     }
     $output .= $item_html;
 }
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     if (is_object($args) && !empty($args->has_children) && $item->menu_item_parent == 0) {
         $link_after = $args->link_after;
         $args->link_after = ' <b class="caret"></b>';
     }
     parent::start_el($output, $item, $depth, $args, $id);
     if (is_object($args) && !empty($args->has_children)) {
         $args->link_after = $link_after;
     }
 }
示例#22
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if ($item->is_dropdown && $depth === 0) {
         $item_html = str_replace('</a>', '<span class="glyphicon glyphicon-chevron-down"></span></a>', $item_html);
     } elseif ($item->is_dropdown && $depth > 0) {
         $item_html = str_replace('</a>', '<span class="glyphicon glyphicon-chevron-right"></span></a>', $item_html);
     }
     $item_html = apply_filters('dw_timeline_wp_nav_menu_item', $item_html);
     $output .= $item_html;
 }
示例#23
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if (stristr($item_html, 'li class="divider')) {
         $item_html = preg_replace('/<a[^>]*>.*?<\\/a>/iU', '', $item_html);
     } elseif (stristr($item_html, 'li class="dropdown-header')) {
         $item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '$1', $item_html);
     }
     $item_html = apply_filters('roots_wp_nav_menu_item', $item_html);
     $output .= $item_html;
 }
示例#24
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     $output .= 0 == $depth ? '<li class="divider"></li>' : '';
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     if (in_array('section', $classes)) {
         $output .= '<li class="divider"></li>';
         $item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '<label>$1</label>', $item_html);
     }
     $output .= $item_html;
 }
示例#25
0
 function start_el(&$output, $item, $depth, $args)
 {
     $args = (object) $args;
     $root = $depth == 0;
     if ($root) {
         $this->top_count++;
     }
     $args->before = $root ? "\n" . ($this->top_wrap ? str_repeat("\t", $depth + 4) . "<div class=\"navwrap\">\n" : "") . "\t\t\t\t\t" : "\t";
     $args->link_after = $root ? "" : ($this->has_subnav($item) ? $this->disclosure : "") . "<span></span>";
     $output .= str_repeat("\t", $depth + 3 + ($depth - 1 * 2) + 3 - ($root ? 1 : 0));
     parent::start_el($output, $item, $depth, $args);
 }
示例#26
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if ($item->is_dropdown && $depth === 0) {
         $item_html = str_replace('<a', '<a class="dropdown-toggle" data-toggle="dropdown" data-target="#"', $item_html);
     } elseif (stristr($item_html, 'li class="divider')) {
         $item_html = preg_replace('/<a[^>]*>.*?<\\/a>/iU', '', $item_html);
     } elseif (stristr($item_html, 'li class="nav-header')) {
         $item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '$1', $item_html);
     }
     $output .= $item_html;
 }
 public function start_el(&$output, $item, $depth = 0, $args = [], $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args, $id);
     if ($item->is_dropdown) {
         //var_dump($item);
         /*
             $item_html = preg_replace('/<a([^>]*)>(.*)<\/a>/iU', '<a$1>$2</a>', $item_html);
             $item_html = preg_replace('/\s?href=".*?"/iU', '', $item_html);
         */
     }
     $output .= apply_filters('boilerplate/wp_nav_menu_item/start_el', $item_html, $item, $depth, $args);
 }
示例#28
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if ($item->is_dropdown && $depth === 0) {
         $item_html = str_replace('<a', '<a class="dropdown-toggle" data-toggle="dropdown" data-target="#"', $item_html);
         $item_html = str_replace('</a>', ' <b class="caret"></b></a>', $item_html);
     } elseif (stristr($item_html, 'li class="divider')) {
         $item_html = preg_replace('/<a[^>]*>.*?<\\/a>/iU', '', $item_html);
     } elseif (stristr($item_html, 'li class="dropdown-header')) {
         $item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '$1', $item_html);
     }
     $item_html = apply_filters('roots_wp_nav_menu_item', $item_html);
     $output .= $item_html;
 }
示例#29
0
 /**
  * Modify the element output: columns here!
  *
  * @uses Walker_Nav_Menu::start_el()
  *
  * @param string $output Passed by reference. Used to append additional content.
  * @param object $item   Menu item data object.
  * @param int    $depth  Depth of menu item. Used for padding.
  * @param array  $args   An array of arguments. @see wp_nav_menu()
  * @param int    $id     Current item ID.
  */
 public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     // Get number of elements
     if (null === self::$num) {
         self::$num = (int) appica_get_option('offcanvas_anchor_el_num', 6);
     }
     // Check for columns
     if (self::$i !== 0 && self::$i % self::$num === 0) {
         $output .= '</ul><ul>';
         // columns!
     }
     self::$i++;
     // Render menu item
     parent::start_el($output, $item, $depth, $args, $id);
 }
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $item_html = '';
     parent::start_el($item_html, $item, $depth, $args);
     if (!$item->is_dropdown && $depth === 0) {
         $item_html = str_replace('<a', '<a class="item-link"', $item_html);
         $item_html = str_replace('</a>', '</a>', $item_html);
     }
     if ($item->is_dropdown) {
         $item_html = str_replace('<a', '<a class="item-link dropdown-toggle"', $item_html);
         $item_html = str_replace('</a>', '</a>', $item_html);
         $item_html .= '<span class="show-dropdown"></span>';
     }
     $output .= $item_html;
 }