コード例 #1
0
 /**
  * Starts the list before the elements are added.
  *
  * @see Walker::start_lvl()
  *
  * @since 1.0.0
  *
  * @param string $output Passed by reference. Used to append additional content.
  * @param int    $depth  Depth of menu item. Used for padding.
  * @param array  $args   An array of arguments. @see wp_nav_menu()
  */
 function start_lvl(&$output, $depth = 0, $args = array())
 {
     $indent = str_repeat("\t", $depth);
     $classes = 'cherry-mega-menu-sub level-' . $depth;
     $effect = cherry_mega_menu_get_option('mega-menu-effect', 'slide-top');
     $classes .= ' effect-' . $effect;
     if (true === $this->is_mega_sub) {
         $classes .= ' mega-sub';
     } else {
         $classes .= ' simple-sub';
     }
     $output .= "\n{$indent}<ul class=\"{$classes}\">\n";
 }
コード例 #2
0
 function __construct()
 {
     $menu_enabled = cherry_mega_menu_get_option('mega-menu-enabled', 'true');
     if ('false' === $menu_enabled) {
         return;
     }
     $cache_enabled = cherry_mega_menu_get_option('mega-menu-cache');
     if ('true' != $cache_enabled) {
         return;
     }
     if (is_admin()) {
         $this->_admin();
     } else {
         $this->_public();
     }
 }
コード例 #3
0
 /**
  * Add mobile menu label before menu content
  *
  * @since  1.0.0
  *
  * @param  string  $menu  menu content
  * @param  array   $args  menu args
  * @return string         menu content with mobile label
  */
 function add_menu_mobile_label($menu, $args)
 {
     // make sure we're working with a Mega Menu
     if (!is_a($args->walker, 'cherry_mega_menu_walker')) {
         return $menu;
     }
     $label = cherry_mega_menu_get_option('mega-menu-mobile-label', __('Menu', 'cherry-mega-menu'));
     $before_menu_label = '<label class="cherry-mega-menu-mobile-trigger" for="trigger-' . $args->menu_id . '">' . esc_textarea($label) . '</label><input class="cherry-mega-menu-mobile-trigger-box" id="trigger-' . $args->menu_id . '" type="checkbox">';
     $after_menu_label = '<label class="cherry-mega-menu-mobile-close" for="trigger-' . $args->menu_id . '">' . __('Close', 'cherry-mega-menu') . '</label>';
     return $before_menu_label . $menu . $after_menu_label;
 }