Пример #1
0
function render_main_menu()
{
    $menu_name = 'main-menu';
    // name of rendered menu
    if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
        $menu = wp_get_nav_menu_object($locations[$menu_name]);
        $menu_items = wp_get_nav_menu_items($menu->term_id);
        $menu_list = "<nav>\n";
        $menu_list .= "\t\t\t\t<ul>\n";
        foreach ((array) $menu_items as $key => $menu_item) {
            // loop menu entries
            $title = $menu_item->title;
            $classes = implode(" ", $menu_item->classes);
            $url = make_href_root_relative($menu_item->url);
            $menu_list .= "\t\t\t\t\t<li class=\"{$classes}\"><a href=\"{$url}\"><span>{$title}</span></a></li>\n";
        }
        $menu_list .= "\t\t\t\t</ul>\n";
        $menu_list .= "\t\t\t</nav>\n";
    } else {
        // try to render default menu
        $menu_list = wp_nav_menu(array('theme_location' => 'main-menu', 'container_class' => 'main-menu-container', 'container' => 'nav', 'menu_id' => 'main-menu', 'menu_class' => '', 'echo' => false));
        // $menu_list = '<!-- no list defined -->';
    }
    echo $menu_list;
}
 function findMenu($id = null)
 {
     $locations = get_registered_nav_menus();
     $menus = wp_get_nav_menus();
     if ($id) {
         foreach ($menus as $menu) {
             if ($id == $menu->term_id) {
                 return $menu;
             }
         }
         return null;
     }
     $menu_locations = get_nav_menu_locations();
     $return = null;
     // find current menu
     foreach ($locations as $location => $description) {
         foreach ($menus as $menu) {
             if (isset($menu_locations[$location]) && $menu_locations[$location] == $menu->term_id) {
                 $return = $menu;
                 break;
             }
         }
     }
     return $return;
 }
Пример #3
0
 /**
  * Return the global menu with a material design HTML structure
  */
 public static function getMenuItems($menuName)
 {
     if (($locations = get_nav_menu_locations()) && isset($locations[$menuName])) {
         $menu = wp_get_nav_menu_object($locations[$menuName]);
         return wp_get_nav_menu_items($menu->term_id);
     }
 }
Пример #4
0
function dt_get_simple_menu($opts = array())
{
    $defaults = array('menu_name' => 'top-menu', 'wrap' => '<ul class="right-top">%ITEMS%</ul>', 'item_wrap' => '<li><a href="%URL%">%TITLE%</a></li>', 'echo' => true);
    $opts = apply_filters('dt_get_simple_menu_options', wp_parse_args($opts, $defaults));
    $opts = wp_parse_args($opts, $defaults);
    if (($locations = get_nav_menu_locations()) && isset($locations[$opts['menu_name']])) {
        $menu = wp_get_nav_menu_object($locations[$opts['menu_name']]);
        if ($menu) {
            $menu_items = wp_get_nav_menu_items($menu->term_id);
            $menu_list = '';
            foreach ((array) $menu_items as $key => $menu_item) {
                $title = $menu_item->title;
                $url = $menu_item->url;
                $menu_list .= str_replace(array('%URL%', '%TITLE%'), array($url, $title), $opts['item_wrap']);
            }
            $menu_list = str_replace('%ITEMS%', $menu_list, $opts['wrap']);
            if ($opts['echo']) {
                echo $menu_list;
                return false;
            }
            return $menu_list;
        }
    }
    return null;
}
function clean_custom_menus()
{
    $menu_name = 'primary';
    // specify custom menu slug
    if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
        $menu = wp_get_nav_menu_object($locations[$menu_name]);
        $menu_items = wp_get_nav_menu_items($menu->term_id);
        $menu_list = '<nav>' . "\n";
        $menu_list .= '<ul class="desktop">' . "\n";
        foreach ((array) $menu_items as $key => $menu_item) {
            $title = $menu_item->title;
            $url = $menu_item->url;
            $menu_list .= '<a href="' . $url . '"><li>' . $title . '</li></a>' . "\n";
        }
        $menu_list .= '</ul>' . "\n";
        $menu_list .= "<div class='mobileNav'><div class='mobile-hamburger'><span></span></div>";
        $menu_list .= '<ul class="mobile">' . "\n";
        foreach ((array) $menu_items as $key => $menu_item) {
            $title = $menu_item->title;
            $url = $menu_item->url;
            $menu_list .= '<a href="' . $url . '"><li>' . $title . '</li></a>' . "\n";
        }
        $menu_list .= '</ul></div>' . "\n";
        $menu_list .= '</nav>' . "\n";
    } else {
        $menu_list = '<!-- no list defined -->';
    }
    echo $menu_list;
}
Пример #6
0
 /**
  * Returns all the settings fields
  *
  * @return array settings fields
  */
 function get_settings_fields()
 {
     $locations = get_nav_menu_locations();
     /*
     $locations = Array
     	(
     		[location_name] = > currently_assigned_menu_id
     		[primary] => 12
     		[sidebar] => 2
     		[footer] => 0
     		
     	)
     */
     $exclude_theme_locations_opt = array();
     foreach ($locations as $key => $val) {
         $exclude_theme_locations_opt[$key] = ucfirst($key);
     }
     // Get menus
     $menus = wp_get_nav_menus();
     $exclude_menus_opt = array();
     foreach ($menus as $menu) {
         $exclude_menus_opt[$menu->term_id . "|" . $menu->slug . "|" . $menu->name] = $menu->name;
     }
     $settings_fields = array('wp_nav_menu_cache' => array(array('name' => 'exclude_theme_locations', 'label' => 'Exclude Theme Locations', 'desc' => "Check theme location you don't want to cache any menu of", 'type' => 'multicheck', 'options' => $exclude_theme_locations_opt), array('name' => 'exclude_menus', 'label' => 'Exclude Menus', 'desc' => "Check wich menu you don't want to cache.<br>You need this if you use Custom Menu widget or if you assign a menu with the call of wp_nav_menu() function in theme files.", 'type' => 'multicheck', 'options' => $exclude_menus_opt), array('name' => 'individual_url', 'label' => 'Cache for Individual URL', 'desc' => 'Enable <br><span style="color:#ff0000">You should not enable this option if you have a huge number of <strong>posts/pages</strong> on your site.<br>This option caches each menu individually <strong>for each post/page or any visited url</strong>.<br>This can result in a <strong>huge number of cached menu files</strong> on your site, which could actually resulted in a <strong>slower site</strong>.<br>It could also cross the <strong>limitation of number of files</strong> in a single directory.</span>', 'type' => 'checkbox')));
     return $settings_fields;
 }
 function van_check_menu()
 {
     global $VAN;
     //If custom menu exist,get the ID of pages
     if (($locations = get_nav_menu_locations()) && $locations['primary_navi']) {
         $menu = wp_get_nav_menu_object($locations['primary_navi']);
         $menu_items = wp_get_nav_menu_items($menu->term_id);
         $pageID = array();
         foreach ($menu_items as $item) {
             if ($item->object == 'page') {
                 $pageID[] = $item->object_id;
             }
         }
         query_posts(array('post_type' => 'page', 'post__in' => $pageID, 'posts_per_page' => count($pageID), 'orderby' => 'post__in'));
     } else {
         //If custom menu doesn't exist,check default page menu setting in theme options
         //If default page menu setting exist
         if (isset($VAN['pages_navi']) && $VAN['pages_navi'] != '') {
             query_posts(array('post_type' => 'page', 'post__in' => $VAN['pages_navi'], 'posts_per_page' => count($VAN['pages_navi']), 'orderby' => 'menu_order', 'order' => 'ASC'));
         } else {
             //If default page menu setting doesn't exist
             query_posts(array('post_type' => 'page', 'posts_per_page' => 6, 'orderby' => 'menu_order', 'order' => 'ASC'));
         }
     }
 }
Пример #8
0
 /**
  * Echo the widget content.
  *
  * @since 1.0.0
  *
  * @param array $args     Display arguments including before_title, after_title,
  *                        before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget.
  */
 function widget($args, $instance)
 {
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     $size = !empty($instance['size']) ? $instance['size'] : 'medium';
     echo $args['before_widget'];
     // Render title.
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     $nav_menu_locations = get_nav_menu_locations();
     $menu_id = 0;
     if (isset($nav_menu_locations['social']) && absint($nav_menu_locations['social']) > 0) {
         $menu_id = absint($nav_menu_locations['social']);
     }
     if ($menu_id > 0) {
         $menu_items = wp_get_nav_menu_items($menu_id);
         if (!empty($menu_items)) {
             echo '<ul class="size-' . esc_attr($size) . '">';
             foreach ($menu_items as $m_key => $m) {
                 echo '<li>';
                 echo '<a href="' . esc_url($m->url) . '" target="_blank">';
                 echo '<span class="title screen-reader-text">' . esc_attr($m->title) . '</span>';
                 echo '</a>';
                 echo '</li>';
             }
             echo '</ul>';
         }
     }
     echo $args['after_widget'];
 }
 function customize_registering($wp_customize)
 {
     global $xili_language;
     // in_nav_menu
     $locations = get_registered_nav_menus();
     $menus = wp_get_nav_menus();
     $menu_locations = get_nav_menu_locations();
     $num_locations = count(array_keys($locations));
     if ($num_locations >= 1 && count($menu_locations) >= 1) {
         $wp_customize->add_section('xili_options_section', array('title' => __('Multilingual Options ©xili', 'xili-language'), 'priority' => 300, 'description' => sprintf(_n('Your theme supports %s menu. Customize style.', 'Your theme supports %s menus. Customize style.', $num_locations, 'xili-language'), number_format_i18n($num_locations)) . "\n\n" . __('You can edit your menu content on the Menus screen in the Appearance section.')));
         $location_slugs = array_keys($locations);
         if (0 == $xili_language->has_languages_list_menu($location_slugs[0])) {
             // only test one menu during transition
             $wp_customize->add_setting('xili_language_settings[in_nav_menu]', array('default' => '', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
             $wp_customize->add_control('in_nav_menu', array('settings' => 'xili_language_settings[in_nav_menu]', 'label' => __('Append the languages', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'radio', 'choices' => array('disable' => __('No languages menu-items', 'xili-language'), 'enable' => __('Show languages menu-items', 'xili-language'))));
             $wp_customize->add_setting('xili_language_settings[nav_menu_separator]', array('default' => '|', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
             $wp_customize->add_control('nav_menu_separator', array('settings' => 'xili_language_settings[nav_menu_separator]', 'label' => __('Separator before language list (Character or Entity Number or Entity Name)', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'text'));
         }
         if (!current_theme_supports('custom_xili_flag')) {
             $wp_customize->add_setting($this->settings_name . '[no_flags]', array('default' => '', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
             $wp_customize->add_control('no_flags', array('settings' => $this->settings_name . '[no_flags]', 'label' => __('Hide the flags', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'checkbox'));
         }
     } else {
         $wp_customize->add_section('xili_options_section', array('title' => __('Multilingual Options ©xili', 'xili-language'), 'priority' => 300, 'description' => __('None nav menus location seems active', 'xili-language')));
     }
     $wp_customize->add_setting($this->settings_name . '[linked_posts]', array('default' => '', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
     $wp_customize->add_control('linked_posts', array('settings' => $this->settings_name . '[linked_posts]', 'label' => __('Show linked posts', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'checkbox'));
 }
function theme_get_menu($args = '')
{
    $args = apply_filters('wp_nav_menu_args', $args);
    $nav_menu = apply_filters('pre_wp_nav_menu', null, $args);
    if (null !== $nav_menu) {
        return $nav_menu;
    }
    $args = wp_parse_args($args, array('source' => 'Pages', 'depth' => 0, 'menu' => null, 'class' => ''));
    $source =& $args['source'];
    $menu =& $args['menu'];
    $class =& $args['class'];
    if ($menu != null && is_string($menu)) {
        // theme location
        $location = theme_get_array_value(get_nav_menu_locations(), $menu);
        if ($location) {
            $menu = wp_get_nav_menu_object($location);
            if ($menu) {
                $source = 'Custom Menu';
                $class = implode(' ', array($class, 'menu-' . $menu->term_id));
            }
        }
    }
    if ($source == 'Custom Menu' && $menu != null) {
        $nav_menu = theme_get_list_menu($args);
    } elseif ($source == 'Pages') {
        $nav_menu = theme_get_list_pages(array_merge(array('sort_column' => 'menu_order, post_title'), $args));
    } elseif ($source == 'Categories') {
        $nav_menu = theme_get_list_categories(array_merge(array('title_li' => false), $args));
    }
    return apply_filters('wp_nav_menu', $nav_menu, $args);
}
Пример #11
0
  * 
  */
 load_theme_textdomain('szia', get_template_directory() . '/languages');
 // This theme styles the visual editor with editor-style.css to match the theme style.
 add_editor_style();
 // Custom Header
 $defaults = array('default-image' => '', 'random-default' => false, 'width' => 0, 'height' => 0, 'flex-height' => false, 'flex-width' => false, 'default-text-color' => '', 'header-text' => true, 'uploads' => true, 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '');
 add_theme_support('custom-header', $defaults);
 // Adds RSS feed links to <head> for posts and comments.
 add_theme_support('automatic-feed-links');
 // This theme supports a variety of post formats.
 add_theme_support('post-formats', array('gallery', 'image', 'video'));
 // This theme uses wp_nav_menu() in one location.
 register_nav_menu('primary', __('Primary Menu', 'szia'));
 register_nav_menu('secondary', __('Secondary Menu', 'szia'));
 /*
  * This theme supports custom background color and image, and here
  * we also set up the default background color.
  */
 add_theme_support('custom-background', array('default-color' => 'e6e6e6'));
 // This theme uses a custom image size for featured images, displayed on "standard" posts.
 add_theme_support('post-thumbnails');
 //set_post_thumbnail_size( 590, 211 ); // Unlimited height, soft crop
 // Used for large feature (header) images.
 //add_image_size( 'large-feature', $custom_header_support['width'], $custom_header_support['height'], true );
Пример #12
0
function _wpsc_menu_exists($args)
{
    $args = (object) $args;
    // Get the nav menu based on the requested menu
    $menu = wp_get_nav_menu_object($args->menu);
    // Get the nav menu based on the theme_location
    if (!$menu && $args->theme_location && ($locations = get_nav_menu_locations()) && isset($locations[$args->theme_location])) {
        $menu = wp_get_nav_menu_object($locations[$args->theme_location]);
    }
    // get the first menu that has items if we still can't find a menu
    if (!$menu && !$args->theme_location) {
        $menus = wp_get_nav_menus();
        foreach ($menus as $menu_maybe) {
            if ($menu_items = wp_get_nav_menu_items($menu_maybe->term_id)) {
                $menu = $menu_maybe;
                break;
            }
        }
    }
    // If the menu exists, get its items.
    if ($menu && !is_wp_error($menu) && !isset($menu_items)) {
        $menu_items = wp_get_nav_menu_items($menu->term_id);
    }
    // If no menu was found or if the menu has no items and no location was requested, call the fallback_cb if it exists
    if (!$menu || is_wp_error($menu) || isset($menu_items) && empty($menu_items) && !$args->theme_location) {
        return false;
    }
    // If no fallback function was specified and the menu doesn't exists, bail.
    if (!$menu || is_wp_error($menu) || empty($menu_items)) {
        return false;
    }
    return (bool) $menu;
}
Пример #13
0
function theme_get_menu($args = '')
{
    $args = wp_parse_args($args, array('source' => 'Pages', 'depth' => 0, 'menu' => null, 'class' => ''));
    $source =& $args['source'];
    $menu =& $args['menu'];
    $class =& $args['class'];
    if ($menu != null && is_string($menu)) {
        // theme location
        $location = theme_get_array_value(get_nav_menu_locations(), $menu);
        if ($location) {
            $menu = wp_get_nav_menu_object($location);
            if ($menu) {
                $source = 'Custom Menu';
                //Jordi
                //$class = implode(' ', array($class, 'menu-' . $menu->term_id));
                $class = implode(' ', array($class, 'menu-' . $menu->term_id, 'nav navbar-right'));
            }
        }
    }
    if ($source == 'Custom Menu' && $menu != null) {
        return theme_get_list_menu($args);
    }
    if ($source == 'Pages') {
        return theme_get_list_pages(array_merge(array('sort_column' => 'menu_order, post_title'), $args));
    }
    if ($source == 'Categories') {
        return theme_get_list_categories(array_merge(array('title_li' => false), $args));
    }
}
 public function widget($args, $instance)
 {
     extract($args);
     $defaults = array('title' => '', 'menu' => 'primary', 'description' => '');
     $instance = wp_parse_args((array) $instance, $defaults);
     $locations = get_nav_menu_locations();
     $title = '';
     // Create beautiful title
     if (isset($instance['title'])) {
         $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
         if (!empty($title)) {
             $title_array = explode(" ", $title);
             $title = "";
             foreach ($title_array as $tcount => $word) {
                 if ($tcount == 0) {
                     $word = "<strong>" . $word . "</strong>";
                 }
                 $title .= $word . " ";
             }
             $title = "<h2>" . $title . "</h2>";
         }
     }
     // Build menu options
     $opts = array('theme_location' => '', 'menu' => $locations[isset($instance['menu']) ? $instance['menu'] : 'primary-menu'], 'container' => '', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'depth' => 0, 'walker' => '');
     // Create widget
     echo '<div class="widget">';
     echo $before_widget;
     echo $title;
     // Build menu
     wp_nav_menu($opts);
     echo !empty($instance['description']) ? '<p><!-- WHITESPACE --></p><ul><p>' . $instance['description'] . '</p></ul>' : '';
     echo $after_widget;
     echo '</div>';
 }
Пример #15
0
 function ut_prepare_front_query()
 {
     /* needed variables and arrays */
     $ut_query_pages = array();
     /* check if primary navigation has been created and set */
     if (has_nav_menu('primary')) {
         /* get primary navigation ID */
         $ut_theme_locations = get_nav_menu_locations();
         $ut_menu_objects = get_term($ut_theme_locations['primary'], 'nav_menu');
         $ut_menu_id = $ut_menu_objects->term_id;
         /* now we get all menu items from primary navigation  */
         $menu_args = array('orderby' => 'menu_order');
         $ut_menu_items = wp_get_nav_menu_items($ut_menu_id, $menu_args);
         /* create an array of page ID's for query_posts() */
         foreach ((array) $ut_menu_items as $key => $ut_menu_item) {
             $blog_page_id = get_option('page_for_posts');
             $frontpage_id = get_option('page_on_front');
             if ($ut_menu_item->menutype == 'section' && $blog_page_id != $ut_menu_item->object_id && $frontpage_id != $ut_menu_item->object_id) {
                 $ut_query_pages[] = $ut_menu_item->object_id;
                 /* get child pages */
                 $children = ut_get_posts_children_ids($ut_menu_item->object_id);
                 $ut_query_pages = array_merge($ut_query_pages, $children);
             }
         }
         /* return query arguements */
         if (!empty($ut_query_pages)) {
             /* query args for main query  */
             $pagequery = array('posts_per_page' => count($ut_query_pages), 'post_type' => 'page', 'post__in' => $ut_query_pages, 'orderby' => 'post__in');
             return $pagequery;
         } else {
             /* return empty arguments */
             return array();
         }
     }
 }
function acp_skiplinks_output()
{
    check_ajax_referer('acp-sec-skiplinks', 'security');
    $hp_skiplinks = get_option('acp_skiplinks_home', false);
    if ($hp_skiplinks) {
        $menu_name = is_home() || is_front_page() ? 'skiplinks-home' : 'skiplinks';
    } else {
        $menu_name = 'skiplinks';
    }
    if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
        $menu = wp_get_nav_menu_object($locations[$menu_name]);
        $menu_items = wp_get_nav_menu_items($menu->term_id);
        $menu_side = get_option('acp_skiplinks_side', false);
        $menu_list = '<ul id="acp_skiplinks" role="navigation" class="' . $menu_side . '">';
        foreach ((array) $menu_items as $key => $menu_item) {
            $title = $menu_item->title;
            $url = $menu_item->url;
            $menu_list .= '<li><a href="' . $url . '" class="skiplinks">' . $title . '</a></li>';
        }
        $menu_list .= '</ul></nav>';
    } else {
        $menu_list = '<ul><li>Menu "' . $menu_name . '" not defined.</li></ul>';
    }
    if (get_option('acp_skiplinks', false)) {
        echo $menu_list;
    }
    die;
}
Пример #17
0
function clear_menu_from_old_woo_pages()
{
    $locations = get_nav_menu_locations();
    $logout = get_page_by_path('my-account/logout');
    $parent = get_page_by_path('my-account');
    $permalink = get_option('permalink_structure');
    $pages_deleted = array(get_option('woocommerce_pay_page_id'), get_option('woocommerce_thanks_page_id'), get_option('woocommerce_view_order_page_id'), get_option('woocommerce_view_order_page_id'), get_option('woocommerce_change_password_page_id'), get_option('woocommerce_edit_address_page_id'), get_option('woocommerce_lost_password_page_id'));
    foreach ((array) $locations as $name => $menu_ID) {
        $items = wp_get_nav_menu_items($menu_ID);
        foreach ((array) $items as $item) {
            if (!is_null($logout) && !is_null($parent) && $item->object_id == $logout->ID) {
                update_post_meta($item->ID, '_menu_item_object', 'custom');
                update_post_meta($item->ID, '_menu_item_type', 'custom');
                if ($permalink == '') {
                    $new_url = get_permalink($parent->ID) . '&customer-logout';
                } else {
                    wp_update_post(array('ID' => $logout->ID, 'post_name' => 'customer-logout'));
                    $new_url = get_permalink($logout->ID);
                }
                update_post_meta($item->ID, '_menu_item_url', $new_url);
                wp_update_post(array('ID' => $item->ID, 'post_title' => $logout->post_title));
            }
            foreach ($pages_deleted as $page) {
                if ($page && $item->object_id == $page && $item->object == 'page') {
                    wp_delete_post($item->ID);
                }
            }
        }
    }
}
Пример #18
0
function theme_get_menu($args = '')
{
    $args = wp_parse_args($args, array('source' => 'Pages', 'depth' => 0, 'menu' => null, 'class' => ''));
    $source =& $args['source'];
    $menu =& $args['menu'];
    if (function_exists('get_nav_menu_locations') && $menu != null && is_string($menu)) {
        // theme location
        $location = theme_get_array_value(get_nav_menu_locations(), $menu);
        if ($location) {
            $menu = wp_get_nav_menu_object($location);
            if ($menu) {
                $source = 'Custom Menu';
            }
        }
    }
    if ($source == 'Custom Menu' && function_exists('wp_nav_menu') && $menu != null) {
        return theme_get_list_menu($args);
    }
    if ($source == 'Pages') {
        return theme_get_list_pages(array_merge(array('sort_column' => 'menu_order, post_title'), $args));
    }
    if ($source == 'Categories') {
        return theme_get_list_categories(array_merge(array('title_li' => false), $args));
    }
}
Пример #19
0
function expanded_nav_menu_css_class($classes = array(), $item, $args)
{
    $location_name = 'expanded_navigation';
    static $top_level_count = 0;
    //Top level menu items counter
    if ($args->theme_location == $location_name) {
        //Limit to this menu location only
        if ($item->menu_item_parent == 0 and $top_level_count !== null) {
            //Count top level menu items
            $top_level_count++;
            //Increment
        }
        if (($locations = get_nav_menu_locations()) && isset($locations[$location_name])) {
            $main_nav = wp_get_nav_menu_object($locations[$location_name]);
            if ($item->menu_item_parent == 0) {
                $classes[] = 'col-lg-15 col-md-3 col-sm-4 ex-menu-item';
            }
            if ($item->menu_order == 1) {
                $classes[] = 'menu-item menu-item-first';
                //First menu item
            }
            if ($top_level_count == count_top_level_menu_items($main_nav->term_id)) {
                $classes[] = 'menu-item-last';
                //Last top level menu item
                $top_level_count = null;
                //Disable our counter, no need for it
            }
        }
    }
    return $classes;
}
Пример #20
0
 /**
  * Generate arguments depends on location and menu
  */
 function get_args($args)
 {
     $this->profile_id = WR_Megamenu_Helpers_Functions::get_profile_by_location($args['theme_location']);
     if ($this->profile_id) {
         // Show only once in one location
         if ($this->echo == $args['theme_location']) {
             $args['echo'] = FALSE;
         }
         $this->echo = $args['theme_location'];
         $args['profile_id'] = $this->profile_id;
         $this->settings = WR_Megamenu_Helpers_Builder::get_megamenu_data($this->profile_id);
         // load assets for a profile
         $this->load_profile_assets();
         $menu_type = $this->settings['menu_type'];
         $location = $this->settings['location'];
         // Get the nav menu based on the requested menu
         $menu = wp_get_nav_menu_object($menu_type);
         $locations = get_nav_menu_locations();
         if (!$menu && $location && isset($locations[$location])) {
             // Get the nav menu based on the theme_location
             $menu = wp_get_nav_menu_object($locations[$location]);
         }
         if ($menu && $menu->term_id == $menu_type && isset($locations[$location])) {
             $args['menu_type'] = $menu_type;
             $args['theme_location'] = $location;
             $helper = new WR_Megamenu_Helpers_Frontend();
             return $helper->get_args($args);
         } else {
             return $args;
         }
     } else {
         return $args;
     }
     return $args;
 }
Пример #21
0
 public function getPathFromNavMenu($postId)
 {
     $path = array();
     if (is_page()) {
         if ($this->menuItems === null) {
             $locations = get_nav_menu_locations();
             if (isset($locations['prime_nav_menu'])) {
                 $this->menuItems = wp_get_nav_menu_items($locations['prime_nav_menu']);
             } else {
                 $this->menuItems = false;
             }
         }
         if ($this->menuItems) {
             foreach ($this->menuItems as $menuItem) {
                 if ($menuItem->object_id == $postId) {
                     $node = $this->getNode($menuItem);
                     if ($node) {
                         $path[] = $node;
                     }
                     if ($menuItem->menu_item_parent) {
                         $parentNodes = $this->getParentNodes($menuItem->menu_item_parent);
                         $path = array_merge($path, $parentNodes);
                     }
                     break;
                 }
             }
         }
     }
     $path = array_reverse($path);
     return $path;
 }
function wpmp_theme_init_in_use()
{
    global $wp_registered_sidebars;
    if (sizeof($wp_registered_sidebars) == 0) {
        $sidebars_widgets = get_option('sidebars_widgets');
        if (is_array($sidebars_widgets)) {
            foreach ($sidebars_widgets as $index => $widgets) {
                if ($index != 'wp_inactive_widgets') {
                    register_sidebar(array('id' => $index, 'before_widget' => '<li>', 'after_widget' => '</li>', 'before_title' => '<h2>', 'after_title' => '</h2>'));
                }
            }
        }
    }
    global $wp_registered_widgets;
    foreach ($wp_registered_widgets as $index => $widget) {
        if (function_exists($function = 'wpmp_theme_widget_' . strtolower(str_replace(' ', '_', $widget['name'])))) {
            $wp_registered_widgets[$index]['callback'] = $function;
        }
    }
    global $wpmp_theme_menu_location;
    if (function_exists('get_nav_menu_locations')) {
        $wpmp_theme_menu_locations = get_nav_menu_locations();
        if (is_array($wpmp_theme_menu_locations)) {
            $wpmp_theme_menu_locations = array_keys($wpmp_theme_menu_locations);
            if (sizeof($wpmp_theme_menu_locations) > 0) {
                $wpmp_theme_menu_location = $wpmp_theme_menu_locations[0];
            }
        }
    }
}
function ubermenu_get_settings_fields()
{
    $prefix = UBERMENU_PREFIX;
    $settings_fields = _UBERMENU()->get_settings_fields();
    if ($settings_fields) {
        return $settings_fields;
    }
    $main_assigned = '';
    if (!has_nav_menu('ubermenu')) {
        $main_assigned = 'No Menu Assigned';
    } else {
        $menus = get_nav_menu_locations();
        $menu_title = wp_get_nav_menu_object($menus['ubermenu'])->name;
        $main_assigned = $menu_title;
    }
    $main_assigned = '<span class="ubermenu-main-assigned">' . $main_assigned . '</span>  <p class="ubermenu-desc-understated">The menu assigned to the <strong>UberMenu [Main]</strong> theme location will be displayed.  <a href="' . admin_url('nav-menus.php?action=locations') . '">Assign a menu</a></p>';
    $config_id = 'main';
    $fields = array($prefix . $config_id => ubermenu_get_settings_fields_instance($config_id));
    $fields = apply_filters('ubermenu_settings_panel_fields', $fields);
    //Allow ordering
    foreach ($fields as $section_id => $section_fields) {
        ksort($fields[$section_id]);
        $fields[$section_id] = array_values($fields[$section_id]);
    }
    _UBERMENU()->set_settings_fields($fields);
    // up( $fields , 2 );
    //up( $fields );
    return $fields;
}
Пример #24
0
 function mega_main_menu__array_theme_options($constants)
 {
     foreach (get_registered_nav_menus() as $key => $value) {
         $key = str_replace(' ', '-', $key);
         $theme_menu_locations[$key] = $key;
     }
     foreach (get_nav_menu_locations() as $key => $value) {
         $key = str_replace(' ', '-', $key);
         $theme_menu_locations[$key] = $key;
     }
     $locations_options = array(array('name' => __('Below are all the locations, which are supported this theme. Toggle for change their settings.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'primary_settings', 'type' => 'caption'));
     if (isset($theme_menu_locations) && is_array($theme_menu_locations)) {
         $locations_options[] = array('name' => __('Activate Mega Main Menu in such locations:', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Mega Main Menu and its settings will be displayed in selected locations only after the activation of this location.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'mega_menu_locations', 'type' => 'checkbox', 'values' => $theme_menu_locations, 'default' => array('mega_main_sidebar_menu'));
     } else {
         $locations_options[] = array('name' => __('Firstly, You need to create at least one menu', $constants['MM_TEXTDOMAIN_ADMIN']) . ' (<a href="' . home_url() . '/wp-admin/nav-menus.php">' . __('Theme Menu Settings', $constants['MM_TEXTDOMAIN_ADMIN']) . '</a>) ' . __('and set theme-location for him', $constants['MM_TEXTDOMAIN_ADMIN']) . ' (<a href="' . home_url() . '/wp-admin/nav-menus.php?action=locations">' . __('Theme Menu Locations', $constants['MM_TEXTDOMAIN_ADMIN']) . '</a>).', 'key' => 'no_locations', 'type' => 'caption');
     }
     foreach ($theme_menu_locations as $key => $value) {
         $original_menu_slug = $key;
         $key = str_replace(' ', '-', $key);
         $locations_options = array_merge($locations_options, array(array('name' => __('Layout Options: ', $constants['MM_TEXTDOMAIN_ADMIN']) . '&nbsp; <strong>' . $key . '</strong>', 'key' => $key . '_menu_options', 'type' => 'collapse_start'), array('name' => __('Add to Mega Main Menu:', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('You can add to the primary menu container: logo and search.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_included_components', 'type' => 'checkbox', 'values' => array(__('Company Logo (on left side)', $constants['MM_TEXTDOMAIN_ADMIN']) => 'company_logo', __('Search Box (on right side)', $constants['MM_TEXTDOMAIN_ADMIN']) => 'search_box', __('BuddyPress Bar (on right side)', $constants['MM_TEXTDOMAIN_ADMIN']) => 'buddypress', __('WooCart (on right side)', $constants['MM_TEXTDOMAIN_ADMIN']) => 'woo_cart', __('WPML switcher (on right side)', $constants['MM_TEXTDOMAIN_ADMIN']) => 'wpml_switcher'), 'default' => array('company_logo', 'search_box')), array('name' => __('Height of the first level items', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Set the height for the initial menu container and items of the first level.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_first_level_item_height', 'type' => 'number', 'min' => 20, 'max' => 300, 'units' => 'px', 'values' => '50', 'default' => '50'), array('name' => __('Primary Style', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Select the button style that fits the style of your site.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_primary_style', 'type' => 'radio', 'col_width' => 4, 'values' => array(__('Flat', $constants['MM_TEXTDOMAIN_ADMIN']) => 'flat', __('Buttons <small>(+1 option)</small>', $constants['MM_TEXTDOMAIN_ADMIN']) => 'buttons'), 'default' => array('flat')), array('name' => __('Buttons Height', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Only for "Buttons" style. Specify here height of the first level buttons.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_first_level_button_height', 'type' => 'number', 'min' => 20, 'max' => 300, 'units' => 'px', 'values' => '30', 'default' => '30', 'dependency' => array('element' => 'mega_main_menu_options[' . $key . '_primary_style]', 'value' => array('buttons'))), array('name' => __('Alignment of the first level items', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Choose how to locate menu elements of the first level.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_first_level_item_align', 'type' => 'radio', 'col_width' => 4, 'values' => array(__('Left', $constants['MM_TEXTDOMAIN_ADMIN']) => 'left', __('Center', $constants['MM_TEXTDOMAIN_ADMIN']) => 'center', __('Right', $constants['MM_TEXTDOMAIN_ADMIN']) => 'right', __('Justify (No Logo!)', $constants['MM_TEXTDOMAIN_ADMIN']) => 'justify'), 'default' => array('left')), array('name' => __('Location of icon in first level elements', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Choose where to locate icon for first level items.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_first_level_icons_position', 'type' => 'radio', 'col_width' => 4, 'values' => array(__('Left', $constants['MM_TEXTDOMAIN_ADMIN']) => 'left', __('Above', $constants['MM_TEXTDOMAIN_ADMIN']) => 'top', __('Right', $constants['MM_TEXTDOMAIN_ADMIN']) => 'right', __('Disable Icons In First Level Items', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable_first_lvl', __('Disable Icons Globally', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable_globally'), 'default' => array('left')), array('name' => __('Separator', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Select type of separator between the first level items of this menu.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_first_level_separator', 'type' => 'radio', 'col_width' => 4, 'values' => array(__('None', $constants['MM_TEXTDOMAIN_ADMIN']) => 'none', __('Smooth', $constants['MM_TEXTDOMAIN_ADMIN']) => 'smooth', __('Sharp', $constants['MM_TEXTDOMAIN_ADMIN']) => 'sharp'), 'default' => array('smooth')), array('name' => __('Rounded corners', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Select the value of corners radius.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_corners_rounding', 'type' => 'number', 'min' => 0, 'max' => 100, 'units' => 'px', 'default' => 0), array('name' => __('Trigger', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Show dropdowns by "hover" or "click"?', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_dropdowns_trigger', 'type' => 'radio', 'col_width' => 4, 'values' => array(__('Hover', $constants['MM_TEXTDOMAIN_ADMIN']) => 'hover', __('Click', $constants['MM_TEXTDOMAIN_ADMIN']) => 'click'), 'default' => array('hover')), array('name' => __('Dropdowns Animation', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Select the type of animation to displaying dropdowns. <span style="color: #f11;">Warning:</span> Animation correctly works only in the latest versions of progressive browsers.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_dropdowns_animation', 'type' => 'select', 'values' => array(__('None', $constants['MM_TEXTDOMAIN_ADMIN']) => 'none', __('Unfold', $constants['MM_TEXTDOMAIN_ADMIN']) => 'anim_1', __('Fading', $constants['MM_TEXTDOMAIN_ADMIN']) => 'anim_2', __('Scale', $constants['MM_TEXTDOMAIN_ADMIN']) => 'anim_3', __('Down to Up', $constants['MM_TEXTDOMAIN_ADMIN']) => 'anim_4', __('Dropdown', $constants['MM_TEXTDOMAIN_ADMIN']) => 'anim_5'), 'default' => array('none')), array('name' => __('Minimized on Handheld Devices', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('If this option is activated you get the folded menu on handheld devices.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_mobile_minimized', 'type' => 'checkbox', 'values' => array(__('Enable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'true'), 'default' => array('true')), array('name' => __('Label for Mobile Menu', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Here you can specify label that will be displayed on the mobile version of the menu.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_mobile_label', 'type' => 'text', 'values' => '', 'default' => 'Menu', 'dependency' => array('element' => 'mega_main_menu_options[' . $key . '_mobile_minimized]', 'value' => array('true'))), array('name' => __('Direction', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Here you can determine the direction of the menu. Horizontal for classic top menu bar. Vertical for sidebar menu.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_direction', 'type' => 'radio', 'col_width' => 4, 'values' => array(__('Horizontal <small>(+5 option)</small>', $constants['MM_TEXTDOMAIN_ADMIN']) => 'horizontal', __('Vertical', $constants['MM_TEXTDOMAIN_ADMIN']) => 'vertical'), 'default' => array('horizontal')), array('name' => __('Full Width Initial Container', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('If this option is enabled then the primary container will try to be the full width.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_fullwidth_container', 'type' => 'checkbox', 'values' => array(__('Enable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'true'), 'dependency' => array('element' => 'mega_main_menu_options[' . $key . '_direction]', 'value' => array('horizontal'))), array('name' => __('Height of the first level items when menu is Sticky (or Mobile)', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Set the height for the initial menu container and items of the first level.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_first_level_item_height_sticky', 'type' => 'number', 'min' => 20, 'max' => 300, 'units' => 'px', 'values' => '40', 'default' => '40', 'dependency' => array('element' => 'mega_main_menu_options[' . $key . '_direction]', 'value' => array('horizontal'))), array('name' => __('Sticky', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Check this option to make the menu sticky. Incompatible with the "Vertical" menu. Sticky do not working on mobile devices. If the menu will be is sticky on mobile devices when you open it - you can not click on the last item, because it will always be outside the screen.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_sticky_status', 'type' => 'checkbox', 'values' => array(__('Enable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'true'), 'dependency' => array('element' => 'mega_main_menu_options[' . $key . '_direction]', 'value' => array('horizontal'))), array('name' => __('Sticky scroll offset', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Set the length of the scroll for each user to pass before the menu will stick to the top of the window.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_sticky_offset', 'type' => 'number', 'min' => 0, 'max' => 2000, 'units' => 'px', 'default' => 340, 'dependency' => array('element' => 'mega_main_menu_options[' . $key . '_direction]', 'value' => array('horizontal'))), array('name' => __('Push Content Down', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Dropdown areas pushes the main website content down instead to dropping down over content. This option will be useful only for "Multi column" and "Full width" dropdowns.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_pushing_content', 'type' => 'checkbox', 'values' => array(__('Enable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'true'), 'dependency' => array('element' => 'mega_main_menu_options[' . $key . '_direction]', 'value' => array('horizontal'))), array('name' => __('Shortcode', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('You can copy this code and use in the content of the page in order to display this menu. Do not forget to activate mega menu for this location, using option at the beginning of this page.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'shortcode_integration', 'type' => 'just_html', 'default' => '<pre>[mega_main_menu location="' . $key . '"][/mega_main_menu]</pre>'), array('name' => __('Forced PHP Integration', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('If you have knowledge of PHP you can call this function anywhere in order to display this menu. Please use it only if you professional.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'forced_integration', 'type' => 'just_html', 'default' => '<pre>&lt;?php echo wp_nav_menu( array( "theme_location" => "' . $key . '" ) ); ?&gt;</pre>'), array('name' => '', 'type' => 'collapse_end')));
     }
     $locations_options = array_merge($locations_options, array(array('name' => __('Logo Settings', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'mega_menu_logo', 'type' => 'caption'), array('name' => __('The logo file', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __("Select image to be used as logo in Main Mega Menu. It's recommended to use image with transparent background (.PNG) and sizes from 200 to 800 px.", $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'logo_src', 'type' => 'file', 'default' => $constants['MM_WARE_URL'] . 'framework/src/img/megamain-logo-120x120.png'), array('name' => __('Maximum logo height', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Maximum logo height in terms of percentage in regard to the height of the initial container.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'logo_height', 'min' => 10, 'max' => 100, 'units' => '%', 'type' => 'number', 'default' => 90), array('name' => __('Backup of the configuration', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('You can make a backup of the plugin configuration and restore this configuration later. Notice: Options of each menu item from the section "Menu Structure" is not imported.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'backup', 'type' => 'just_html', 'default' => '<a href="' . get_admin_url() . '?' . $constants['MM_WARE_PREFIX'] . '_page=backup_file">' . __('Download backup file with current settings') . '</a><br /><br />' . __('Upload backup file and restore settings. Chose file and click "Save All Settings".') . '<br /><input class="col-xs-12 form-control input-sm" type="file" name="' . $constants['MM_OPTIONS_NAME'] . '_backup" />')));
     $skins_options = array(array('name' => __('You can change any properties for any menu location', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'mega_menu_skins', 'type' => 'caption'));
     foreach ($theme_menu_locations as $key => $value) {
         $key = str_replace(' ', '-', $key);
         $skins_options = array_merge($skins_options, array(array('name' => __('Skin Options: ', $constants['MM_TEXTDOMAIN_ADMIN']) . '&nbsp; <strong>' . $key . '</strong>', 'key' => $key . '_menu_skin', 'type' => 'collapse_start'), array('name' => __('Skin Options of the Initial Container', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'dropdowns_skin_options', 'type' => 'caption'), array('name' => __('Background Gradient (Color) of the primary container ', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_bg_gradient', 'type' => 'gradient', 'default' => array('color1' => '#428bca', 'color2' => '#2a6496', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Background image of the primary container', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('You can choose and tune the background image for the primary container.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_bg_image', 'type' => 'background_image', 'default' => ''), array('name' => __('First Level Items', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'dropdowns_skin_options', 'type' => 'caption'), array('name' => __('Font of the First Level Item', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('You can change size and weight of the font for first level items.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_first_level_link_font', 'type' => 'font', 'values' => array('font_family', 'font_size', 'font_weight'), 'default' => array('font_family' => 'Inherit', 'font_size' => '13', 'font_weight' => '400')), array('name' => __('Text color of the first level item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_first_level_link_color', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Icons in the first level item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_first_level_icon_font', 'type' => 'number', 'col_width' => 3, 'min' => 0, 'max' => 200, 'units' => 'px', 'values' => '15', 'default' => '15'), array('name' => __('Background Gradient (Color) of the first level item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_first_level_link_bg', 'type' => 'gradient', 'default' => array('color1' => '#428bca', 'color2' => '#2a6496', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Text color of the active first level item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_first_level_link_color_hover', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Background Gradient (Color) of the active first level item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_first_level_link_bg_hover', 'type' => 'gradient', 'default' => array('color1' => '#3498db', 'color2' => '#2980b9', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Background color of the Search Box', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_search_bg', 'type' => 'color', 'default' => '#3498db'), array('name' => __('Text and icon color of the Search Box', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_search_color', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Dropdowns', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'dropdowns_skin_options', 'type' => 'caption'), array('name' => __('Background Gradient (Color) of the Dropdown Area', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_dropdown_wrapper_gradient', 'type' => 'gradient', 'default' => array('color1' => '#ffffff', 'color2' => '#ffffff', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Font of the dropdown menu item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_dropdown_link_font', 'type' => 'font', 'values' => array('font_family', 'font_size', 'font_weight'), 'default' => array('font_family' => 'Inherit', 'font_size' => '12', 'font_weight' => '400')), array('name' => __('Text color of the dropdown menu item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_dropdown_link_color', 'type' => 'color', 'default' => '#428bca'), array('name' => __('Icons of the dropdown menu item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_dropdown_icon_font', 'type' => 'number', 'col_width' => 3, 'min' => 0, 'max' => 200, 'units' => 'px', 'values' => '12', 'default' => '12'), array('name' => __('Background Gradient (Color) of the dropdown menu item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_dropdown_link_bg', 'type' => 'gradient', 'default' => array('color1' => 'rgba(255,255,255,0)', 'color2' => 'rgba(255,255,255,0)', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Border color between dropdown menu items', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_dropdown_link_border_color', 'type' => 'color', 'default' => '#f0f0f0'), array('name' => __('Text color of the dropdown active menu item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_dropdown_link_color_hover', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Background Gradient (Color) of the dropdown active menu item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_dropdown_link_bg_hover', 'type' => 'gradient', 'default' => array('color1' => '#3498db', 'color2' => '#2980b9', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Plain Text Color of the Dropdown', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => $key . '_menu_dropdown_plain_text_color', 'type' => 'color', 'default' => '#333333'), array('name' => '', 'type' => 'collapse_end')));
     }
     $skins_options = array_merge($skins_options, array(array('name' => __('Set of Installed Google Fonts', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Select the fonts to be included on the site. Remember that a lot of fonts affect on the speed of load page. Always remove unnecessary fonts. Font faces can see on this page - ', $constants['MM_TEXTDOMAIN_ADMIN']) . '<a href="http://www.google.com/fonts" target="_blank">Google fonts</a>', 'key' => 'set_of_google_fonts', 'type' => 'multiplier', 'default' => '0', 'values' => array(array('name' => __('Font 1', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'font_item', 'type' => 'collapse_start'), array('name' => __('Fonts Faily', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'family', 'type' => 'select', 'values' => mm_datastore::get_googlefonts_list(), 'default' => 'Open Sans'), array('name' => '', 'key' => 'font_item', 'type' => 'collapse_end'))), array('name' => __('Custom Icons', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('You can add custom raster icons. After saving these settings, icons will become available in a modal window of icons selection. Recommended size 64x64 pixels.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'set_of_custom_icons', 'type' => 'multiplier', 'default' => '1', 'values' => array(array('name' => __('Custom Icon 1', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'icon_item', 'type' => 'collapse_start'), array('name' => __('Icon File', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'custom_icon', 'type' => 'file', 'default' => $constants['MM_WARE_URL'] . 'framework/src/img/megamain-logo-120x120.png'), array('name' => __('Icon File on Hover', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Keep empty to use regular for both', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'custom_icon_hover', 'type' => 'file', 'default' => ''), array('name' => '', 'key' => 'icon_item', 'type' => 'collapse_end'))), array('name' => __('Additional Styles: ', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Here you can add and edit highlighting styles. After that you can select these styles for menu item in "Menus -> Your Menu Item -> Style of This Item" option.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'additional_styles_presets', 'type' => 'multiplier', 'default' => '0', 'values' => array(array('name' => __('Style 1', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'additional_style_item', 'type' => 'collapse_start'), array('name' => __('Style Name', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'style_name', 'type' => 'textfield', 'default' => 'My Highlight Style'), array('name' => __('Font', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'font', 'type' => 'font', 'values' => array('font_family', 'font_size', 'font_weight'), 'default' => array('font_family' => 'Inherit', 'font_size' => '12', 'font_weight' => '400')), array('name' => __('Icon Size', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'icon', 'type' => 'font', 'values' => array('font_size'), 'default' => array('font_size' => '12')), array('name' => __('Text color', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'text_color', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Background Gradient (Color) ', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'bg_gradient', 'type' => 'gradient', 'default' => array('color1' => '#34495E', 'color2' => '#2C3E50', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Text color of the active item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'text_color_hover', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Background Gradient (Color) of the active item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'bg_gradient_hover', 'type' => 'gradient', 'default' => array('color1' => '#3d566e', 'color2' => '#354b60', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => '', 'key' => 'additional_style_item', 'type' => 'collapse_end')))));
     return array(array('title' => 'General', 'key' => 'mm_general', 'icon' => 'im-icon-wrench-3', 'options' => $locations_options), array('title' => 'Skins', 'key' => 'mm_skins', 'icon' => 'im-icon-brush', 'options' => $skins_options), array('title' => 'Specific Options', 'key' => 'mm_specific_options', 'icon' => 'im-icon-hammer', 'options' => array(array('name' => __('Custom CSS', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('You can place here any necessary custom CSS properties.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'custom_css', 'type' => 'textarea', 'col_width' => 12), array('name' => __('Responsive for Handheld Devices', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Enable responsive properties. If this option is enabled, then the menu will be transformed, if the user uses the handheld device.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'responsive_styles', 'type' => 'checkbox', 'values' => array(__('Enable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'true'), 'default' => array('true')), array('name' => __('Responsive Resolution', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Select on which screen resolution menu will be transformed for mobile devices.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'responsive_resolution', 'type' => 'radio', 'col_width' => 3, 'values' => array('480px (iPhone Landscape)' => '480', '768px (iPad Portrait)' => '768', '960px' => '960', '1024px (iPad Landscape)' => '1024'), 'default' => array('1024')), array('name' => __('Use sets of icons', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Here you can activate different sets of icons. Remember that the larger the list of icons - require more of time to loading page.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'icon_sets', 'type' => 'checkbox', 'values' => array(__('IcoMoon (1200)', $constants['MM_TEXTDOMAIN_ADMIN']) => 'icomoon', __('FontAwesome (400)', $constants['MM_TEXTDOMAIN_ADMIN']) => 'fontawesome', __('Glyphicons (200)', $constants['MM_TEXTDOMAIN_ADMIN']) => 'glyphicons'), 'default' => array('icomoon')), array('name' => __('Use Coercive Styles', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('If this option is checked - all CSS properties for this plugin will be have "!important" priority.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'coercive_styles', 'type' => 'checkbox', 'values' => array(__('Enable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'true')), array('name' => __('"Indefinite location" mode', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('<span style="color: #f11;">Warning:</span> If this option is checked - all menus will be replaced by the mega menu. This will be useful only for templates in which are not defined locations of the menu and template has only one menu.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'indefinite_location_mode', 'type' => 'checkbox', 'values' => array(__('Enable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'true')), array('name' => __('Number of widget areas', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Set here how many independent widget areas you need.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'number_of_widgets', 'type' => 'number', 'min' => 0, 'max' => 100, 'units' => 'areas', 'values' => '1', 'default' => '1'), array('name' => __('Language text direction', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('You can select direction of the text for this plugin. LTR - sites where text is read from left to right. RTL - sites where text is read from right to left.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'language_direction', 'type' => 'radio', 'values' => array(__('Left To Right', $constants['MM_TEXTDOMAIN_ADMIN']) => 'ltr', __('Right To Left', $constants['MM_TEXTDOMAIN_ADMIN']) => 'rtl'), 'default' => array('ltr')))), array('title' => 'Settings of the structure', 'key' => 'mm_structure_settings', 'icon' => 'im-icon-checkbox', 'options' => array(array('name' => __('Here you can deactivate the options that you  do not use to customize the menu structure. It helps reduce the number of options and reduce the load on the server.', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'menu_structure_settings', 'type' => 'caption'), array('name' => __('Description of the item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'item_descr', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable')), array('name' => __('Style of the item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'item_style', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable'), 'default' => array('true')), array('name' => __('Visibility Control', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'item_visibility', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable'), 'default' => array('true')), array('name' => __('Icon of the item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'item_icon', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable')), array('name' => __('Hide Text of the Item', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'disable_text', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable')), array('name' => __('Disable Link', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'disable_link', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable')), array('name' => __('Pull to the Other Side', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'pull_to_other_side', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable'), 'default' => array('true')), array('name' => __('Submenu Type', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'submenu_type', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable')), array('name' => __('Side of dropdown elements', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'submenu_drops_side', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable')), array('name' => __('Submenu Columns', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'submenu_columns', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable')), array('name' => __('Enable Full Width Dropdown', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'submenu_enable_full_width', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable')), array('name' => __('Dropdown Background Image', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'submenu_bg_image', 'type' => 'checkbox', 'values' => array(__('Disable', $constants['MM_TEXTDOMAIN_ADMIN']) => 'disable')))), array('title' => 'Documentation & Support', 'key' => 'support', 'icon' => 'im-icon-support', 'options' => array(array('name' => '', 'key' => 'support', 'type' => 'just_html', 'default' => '<br /><br /> <a href="http://manual.extensions.megamain.com/" target="_blank">Online documentation</a>. <br /><br /> If you need support, <br /> If you have a question or suggestion - <br /> Leave a message on our support page <br /> <a href="http://support.megamain.com/?ref=' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '" target="_blank">Support.MegaMain.com</a> (in new window).<br /> <br />'), array('name' => __('Purchase Code', $constants['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Enter here the purchase code of this product. This action unlocks the automatic updates for you. "Where you can find your <a href="http://support.megamain.com/src/img/megamain-find-item-purchase-code.png" target="_blank">Purchase Code</a>".', $constants['MM_TEXTDOMAIN_ADMIN']), 'key' => 'purchase_code', 'type' => 'textfield', 'col_width' => 6, 'default' => ''))));
     // END FRIMARY ARRAY
 }
Пример #25
0
/**
 * @package MegaMain
 * @subpackage MegaMain
 * @since mm 1.0
 */
function mmpm_theme_options_array()
{
    foreach (get_nav_menu_locations() as $key => $value) {
        if ($key !== 'side_navigation' && $key !== 'top_navigation') {
            continue;
        }
        $key = str_replace(' ', '-', $key);
        $theme_menu_locations[$key] = $key;
    }
    $locations_options = array(array('name' => __('Below are all the locations, which are supported this theme. Toggle for change their settings.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'primary_settings', 'type' => 'caption'));
    if (isset($theme_menu_locations) && is_array($theme_menu_locations)) {
        $locations_options[] = array('name' => __('You can activate Mega Main Menu in such locations:', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Mega Main Menu and its settings will be displayed in selected locations only after the activation of this location.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'mega_menu_locations', 'type' => 'checkbox', 'values' => $theme_menu_locations);
    } else {
        $locations_options[] = array('name' => __('Firstly, You need to create at least one menu', MMPM_TEXTDOMAIN_ADMIN) . ' (<a href="' . home_url() . '/wp-admin/nav-menus.php">' . __('Theme Menu Settings', MMPM_TEXTDOMAIN_ADMIN) . '</a>) ' . __('and set theme-location for him', MMPM_TEXTDOMAIN_ADMIN) . ' (<a href="' . home_url() . '/wp-admin/nav-menus.php?action=locations">' . __('Theme Menu Locations', MMPM_TEXTDOMAIN_ADMIN) . '</a>).', 'key' => 'no_locations', 'type' => 'caption');
    }
    foreach (get_nav_menu_locations() as $key => $value) {
        if ($key !== 'side_navigation' && $key !== 'top_navigation') {
            continue;
        }
        $original_menu_slug = $key;
        $key = str_replace(' ', '-', $key);
        $locations_options = array_merge($locations_options, array(array('name' => __('Layout Options: ', MMPM_TEXTDOMAIN_ADMIN) . '&nbsp; <strong>' . $key . '</strong>', 'key' => $key . '_menu_options', 'type' => 'collapse_start'), array('name' => __('Add to Mega Main Menu:', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('You can add to the primary menu container: logo and search.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_included_components', 'type' => 'checkbox', 'values' => array(__('Company Logo (on left side)', MMPM_TEXTDOMAIN_ADMIN) => 'company_logo', __('Search Box (on right side)', MMPM_TEXTDOMAIN_ADMIN) => 'search_box', __('WooCart (on right side)', MMPM_TEXTDOMAIN_ADMIN) => 'woo_cart'), 'default' => array()), array('name' => __('Height of the initial container and menu items of the first level.', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Set the extent for the initial menu container and items of the first level.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_first_level_item_height', 'type' => 'number', 'min' => 20, 'max' => 300, 'units' => 'px', 'values' => '50'), array('name' => __('Alignment of the first level items:', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Choose how to locate menu elements of the first level.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_first_level_item_align', 'type' => 'select', 'values' => array(__('Left', MMPM_TEXTDOMAIN_ADMIN) => 'left', __('Center', MMPM_TEXTDOMAIN_ADMIN) => 'center', __('Right', MMPM_TEXTDOMAIN_ADMIN) => 'right'), 'default' => array('left')), array('name' => __('Location of icon in first level elements', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Choose where to locate icon for first level items.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_first_level_icons_position', 'type' => 'select', 'values' => array(__('Left', MMPM_TEXTDOMAIN_ADMIN) => 'left', __('Above', MMPM_TEXTDOMAIN_ADMIN) => 'top', __('Right', MMPM_TEXTDOMAIN_ADMIN) => 'right', __('Disable Icons In First Level Items', MMPM_TEXTDOMAIN_ADMIN) => 'disable_first_lvl', __('Disable Icons Globally', MMPM_TEXTDOMAIN_ADMIN) => 'disable_globally'), 'default' => array('disable_first_lvl')), array('name' => __('Separator:', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Select type of separator between the first level items of this menu.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_first_level_separator', 'type' => 'select', 'values' => array(__('None', MMPM_TEXTDOMAIN_ADMIN) => 'none', __('Smooth', MMPM_TEXTDOMAIN_ADMIN) => 'smooth', __('Sharp', MMPM_TEXTDOMAIN_ADMIN) => 'sharp'), 'default' => array('smooth')), array('name' => __('Rounded corners', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Select the value of corners radius.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_corners_rounding', 'type' => 'number', 'min' => 0, 'max' => 100, 'units' => 'px', 'default' => 2), array('name' => __('Dropdowns Animation:', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Select the type of animation to displaying dropdowns. <span style="color: #f11;">Warning:</span> Animation correctly works only in the latest versions of progressive browsers.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_dropdowns_animation', 'type' => 'select', 'values' => array(__('None', MMPM_TEXTDOMAIN_ADMIN) => 'none', __('Unfold', MMPM_TEXTDOMAIN_ADMIN) => 'anim_1', __('Fading', MMPM_TEXTDOMAIN_ADMIN) => 'anim_2', __('Scale', MMPM_TEXTDOMAIN_ADMIN) => 'anim_3', __('Down to Up', MMPM_TEXTDOMAIN_ADMIN) => 'anim_4', __('Dropdown', MMPM_TEXTDOMAIN_ADMIN) => 'anim_5'), 'default' => array('none')), array('name' => __('Minimized on Handheld Devices', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('If this option is activated you get the folded menu on handheld devices.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_mobile_minimized', 'type' => 'checkbox', 'values' => array(__('Activate', MMPM_TEXTDOMAIN_ADMIN) => 'true'), 'default' => array('true')), array('name' => __('Direction', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Here you can determine the direction of the menu. Horizontal for classic top menu bar. Vertical for sidebar menu.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_direction', 'type' => 'select', 'values' => array(__('Horizontal', MMPM_TEXTDOMAIN_ADMIN) => 'horizontal', __('Vertical', MMPM_TEXTDOMAIN_ADMIN) => 'vertical'), 'default' => array('horizontal'), 'dependency' => array('element' => array($key . '_sticky_status', $key . '_sticky_offset'), 'value' => 'horizontal')), array('name' => __('Sticky', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Check this option to make the menu sticky. Not working on mobile devices.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_sticky_status', 'type' => 'checkbox', 'values' => array(__('Enable', MMPM_TEXTDOMAIN_ADMIN) => 'true')), array('name' => __('Sticky scroll offset', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Set the length of the scroll for each user to pass before the menu will stick to the top of the window.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_sticky_offset', 'type' => 'number', 'min' => 0, 'max' => 2000, 'units' => 'px', 'default' => 340), array('name' => __('Forced PHP Integration', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('If you have knowledge of PHP you can call this function anywhere in order to display this menu. Please use it only if you professional.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'forced_integration', 'type' => 'just_html', 'default' => '<pre>&lt;?php wp_nav_menu( array( "theme_location" => "' . $original_menu_slug . '" ) ); ?&gt;</pre>'), array('name' => __('', MMPM_TEXTDOMAIN_ADMIN), 'type' => 'collapse_end')));
    }
    $locations_options = array_merge($locations_options, array(array('name' => __('Logo Settings', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'mega_menu_logo', 'type' => 'caption'), array('name' => __('The logo file', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __("Select image to be used as logo in Main Mega Menu. It's recommended to use image with transparent background (.PNG) and sizes from 200 to 800 px.", MMPM_TEXTDOMAIN_ADMIN), 'key' => 'logo_src', 'type' => 'file', 'default' => MMPM_IMG_URI . '/megamain-logo-120x120.png'), array('name' => __('Maximum logo height', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Maximum logo height in terms of percentage in regard to the height of the initial container.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'logo_height', 'min' => 10, 'max' => 99, 'units' => '%', 'type' => 'number', 'default' => 90), array('name' => __('Backup of the settings', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('You can make a backup of the plugin settings and restore this settings later. Notice: Options of each menu item from the section "Menu Structure" is not imported.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'backup', 'type' => 'just_html', 'default' => '<a href="' . get_admin_url() . '?mmpm_page=backup_file">' . __('Download backup file with current settings') . '</a><br /><br />' . __('Upload backup file and restore settings. Chose file and click "Save All Settings".') . '<br /><input class="col-xs-12 form-control input-sm" type="file" name="' . MMPM_OPTIONS_DB_NAME . '_backup" />')));
    $skins_options = array(array('name' => __('You can change any properties for any menu location', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'mega_menu_skins', 'type' => 'caption'));
    foreach (get_nav_menu_locations() as $key => $value) {
        $key = str_replace(' ', '-', $key);
        $skins_options = array_merge($skins_options, array(array('name' => __('Skin Options: ', MMPM_TEXTDOMAIN_ADMIN) . '&nbsp; <strong>' . $key . '</strong>', 'key' => $key . '_menu_skin', 'type' => 'collapse_start'), array('name' => __('Skin Options of the Initial Container', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'dropdowns_skin_options', 'type' => 'caption'), array('name' => __('Background Gradient (Color) of the primary container ', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_bg_gradient', 'type' => 'gradient', 'default' => array('color1' => '#428bca', 'color2' => '#2a6496', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Background image of the primary container', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('You can choose and tune the background image for the primary container.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_bg_image', 'type' => 'background_image', 'default' => ''), array('name' => __('Skin Options of the First Level Items', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'dropdowns_skin_options', 'type' => 'caption'), array('name' => __('Font of the First Level Items', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('You can change size and weight of the font for first level items.', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_first_level_link_font', 'type' => 'font', 'values' => array('font_family', 'font_size', 'font_weight'), 'default' => array('font_family' => 'Verdana', 'font_size' => '13', 'font_weight' => '400')), array('name' => __('Size of icons in the first level items', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_first_level_icon_font', 'type' => 'font', 'values' => array('font_size'), 'default' => array('font_size' => '15')), array('name' => __('Text color of the first level item', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_first_level_link_color', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Background Gradient (Color) of the first level item', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_first_level_link_bg', 'type' => 'gradient', 'default' => array('color1' => 'rgba(255,255,255,0)', 'color2' => 'rgba(255,255,255,0)', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Text color of the active first level item', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_first_level_link_color_hover', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Background Gradient (Color) of the active first level item', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_first_level_link_bg_hover', 'type' => 'gradient', 'default' => array('color1' => '#3498db', 'color2' => '#2980b9', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Background color of the Search Box', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_search_bg', 'type' => 'color', 'default' => '#3498db'), array('name' => __('Text and icon color of the Search Box', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_search_color', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Skin Options of the Dropdowns', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'dropdowns_skin_options', 'type' => 'caption'), array('name' => __('Background Gradient (Color) of the Dropdown elements', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_dropdown_wrapper_gradient', 'type' => 'gradient', 'default' => array('color1' => '#ffffff', 'color2' => '#ffffff', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Font of the dropdown menu item', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_dropdown_link_font', 'type' => 'font', 'values' => array('font_family', 'font_size', 'font_weight'), 'default' => array('font_family' => 'Verdana', 'font_size' => '12', 'font_weight' => '400')), array('name' => __('Text color of the dropdown menu item', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_dropdown_link_color', 'type' => 'color', 'default' => '#428bca'), array('name' => __('Background Gradient (Color) of the dropdown menu item', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_dropdown_link_bg', 'type' => 'gradient', 'default' => array('color1' => 'rgba(255,255,255,0)', 'color2' => 'rgba(255,255,255,0)', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Border color between dropdown menu items', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_dropdown_link_border_color', 'type' => 'color', 'default' => '#f0f0f0'), array('name' => __('Text color of the dropdown active menu item', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_dropdown_link_color_hover', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Background Gradient (Color) of the dropdown active menu item', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_dropdown_link_bg_hover', 'type' => 'gradient', 'default' => array('color1' => '#3498db', 'color2' => '#2980b9', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Plain Text Color of the Dropdown', MMPM_TEXTDOMAIN_ADMIN), 'key' => $key . '_menu_dropdown_plain_text_color', 'type' => 'color', 'default' => '#333333'), array('name' => __('', MMPM_TEXTDOMAIN_ADMIN), 'type' => 'collapse_end')));
    }
    $skins_options = array_merge($skins_options, array(array('name' => __('Set of Installed Fonts', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Select the fonts to be included on the site. Remember that a lot of fonts affect on the speed of load page. Always remove unnecessary fonts. Font faces can see on this page - ', MMPM_TEXTDOMAIN_ADMIN) . '<a href="http://www.google.com/fonts" target="_blank">Google fonts</a>', 'key' => 'set_of_google_fonts', 'type' => 'multiplier', 'default' => '1', 'values' => array(array('name' => __('Font 1', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'font_item', 'type' => 'collapse_start'), array('name' => __('Fonts Faily', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'family', 'type' => 'select', 'values' => mmpm_get_googlefonts_list(), 'default' => 'Open Sans'), array('name' => __('', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'font_item', 'type' => 'collapse_end'))), array('name' => __('Additional Styles: ', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Here you can add and edit highlighting styles.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'additional_styles_presets', 'type' => 'multiplier', 'default' => '1', 'values' => array(array('name' => __('Style 1', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'additional_style_item', 'type' => 'collapse_start'), array('name' => __('Style Name', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'style_name', 'type' => 'textfield', 'default' => 'My Highlight Style'), array('name' => __('Text color', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'text_color', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Background Gradient (Color) ', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'bg_gradient', 'type' => 'gradient', 'default' => array('color1' => '#34495E', 'color2' => '#2C3E50', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('Text color of the active item', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'text_color_hover', 'type' => 'color', 'default' => '#f8f8f8'), array('name' => __('Background Gradient (Color) of the active item', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'bg_gradient_hover', 'type' => 'gradient', 'default' => array('color1' => '#3d566e', 'color2' => '#354b60', 'start' => '0', 'end' => '100', 'orientation' => 'top')), array('name' => __('', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'additional_style_item', 'type' => 'collapse_end'))), array('name' => __('Custom Icons', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('You can add custom raster icons. After saving these settings, icons will become available in a modal window of icons selection. Recommended size 64x64 pixels.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'set_of_custom_icons', 'type' => 'multiplier', 'default' => '1', 'values' => array(array('name' => __('Custom Icon 1', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'icon_item', 'type' => 'collapse_start'), array('name' => __('Icon File', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'custom_icon', 'type' => 'file', 'default' => MMPM_IMG_URI . '/megamain-logo-120x120.png'), array('name' => __('', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'icon_item', 'type' => 'collapse_end')))));
    return array(array('title' => 'General', 'key' => 'general', 'icon' => 'im-icon-wrench-3', 'options' => $locations_options), array('title' => 'Skins', 'key' => 'skins', 'icon' => 'im-icon-brush', 'options' => $skins_options), array('title' => 'Specific Options', 'key' => 'specific_options', 'icon' => 'im-icon-hammer', 'options' => array(array('name' => __('Custom CSS', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('You can place here any necessary custom CSS properties.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'custom_css', 'type' => 'textarea'), array('name' => __('Responsive for Handheld Devices', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Enable responsive properties. If this option is enabled, then the menu will be transformed, if the user uses the handheld device.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'responsive_styles', 'type' => 'checkbox', 'values' => array(__('Activate', MMPM_TEXTDOMAIN_ADMIN) => 'true'), 'default' => array('true')), array('name' => __('Use Coercive Styles', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('If this option is checked - all CSS properties for this plugin will be have "!important" priority.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'coercive_styles', 'type' => 'checkbox', 'values' => array(__('Activate', MMPM_TEXTDOMAIN_ADMIN) => 'true')), array('name' => __('"Indefinite location" mode', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('<span style="color: #f11;">Warning:</span> If this option is checked - all menus will be replaced by the mega menu. This will be useful only for templates in which are not defined locations of the menu and template has only one menu.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'indefinite_location_mode', 'type' => 'checkbox', 'values' => array(__('Activate', MMPM_TEXTDOMAIN_ADMIN) => 'true')), array('name' => __('Number of widget areas', MMPM_TEXTDOMAIN_ADMIN), 'descr' => __('Set here how many independent widget areas you need.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'number_of_widgets', 'type' => 'number', 'min' => 1, 'max' => 100, 'units' => 'areas', 'values' => '1', 'default' => '1'))), array('title' => 'Settings of the structure', 'key' => 'structure_settings', 'icon' => 'im-icon-checkbox', 'options' => array(array('name' => __('Here you can deactivate the options that you  do not use to customize the menu structure. This helps reduce the number of options and reduce the load on the server.', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'menu_structure_settings', 'type' => 'caption'), array('name' => __('Style of the item', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'item_style', 'type' => 'checkbox', 'values' => array(__('Disable', MMPM_TEXTDOMAIN_ADMIN) => 'disable')), array('name' => __('Icon of the item', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'item_icon', 'type' => 'checkbox', 'values' => array(__('Disable', MMPM_TEXTDOMAIN_ADMIN) => 'disable')), array('name' => __('Hide Icon of the Item', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'disable_icon', 'type' => 'checkbox', 'values' => array(__('Disable', MMPM_TEXTDOMAIN_ADMIN) => 'disable')), array('name' => __('Hide Text of the Item', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'disable_text', 'type' => 'checkbox', 'values' => array(__('Disable', MMPM_TEXTDOMAIN_ADMIN) => 'disable')), array('name' => __('Disable Link', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'disable_link', 'type' => 'checkbox', 'values' => array(__('Disable', MMPM_TEXTDOMAIN_ADMIN) => 'disable')), array('name' => __('Submenu Type', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'submenu_type', 'type' => 'checkbox', 'values' => array(__('Disable', MMPM_TEXTDOMAIN_ADMIN) => 'disable')), array('name' => __('Side of dropdown elements', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'submenu_drops_side', 'type' => 'checkbox', 'values' => array(__('Disable', MMPM_TEXTDOMAIN_ADMIN) => 'disable')), array('name' => __('Submenu Columns', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'submenu_columns', 'type' => 'checkbox', 'values' => array(__('Disable', MMPM_TEXTDOMAIN_ADMIN) => 'disable')), array('name' => __('Enable Full Width Dropdown', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'submenu_enable_full_width', 'type' => 'checkbox', 'values' => array(__('Disable', MMPM_TEXTDOMAIN_ADMIN) => 'disable')), array('name' => __('Dropdown Background Image', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'submenu_bg_image', 'type' => 'checkbox', 'values' => array(__('Disable', MMPM_TEXTDOMAIN_ADMIN) => 'disable')))), array('title' => 'Support & Suggestions', 'key' => 'support', 'icon' => 'im-icon-support', 'options' => array(array('name' => __('', MMPM_TEXTDOMAIN_ADMIN), 'key' => 'support', 'type' => 'just_html', 'default' => '<br /><br /> <a href="http://manual.menu.megamain.com/" target="_blank">Online documentation</a>. <br /><br /> If you need support, <br /> If you have a question or suggestion - <br /> Leave a message on our support page <br /> <a href="http://support.megamain.com/?ref=' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '" target="_blank">Support.MegaMain.com</a> (in new window).'))));
    // END FRIMARY ARRAY
}
Пример #26
0
 public static function getMenuLabel($name)
 {
     $locations = get_nav_menu_locations();
     if (isset($locations[$name])) {
         $obj = wp_get_nav_menu_object($locations[$name]);
         return $obj->name;
     }
 }
Пример #27
0
 /**
  * Echos the custom menu title.
  */
 function plexpress_custom_menu_title($location)
 {
     $menu_location = $location;
     $menu_locations = get_nav_menu_locations();
     $menu_object = isset($menu_locations[$menu_location]) ? wp_get_nav_menu_object($menu_locations[$menu_location]) : null;
     $menu_name = isset($menu_object->name) ? $menu_object->name : '';
     echo esc_html($menu_name);
 }
Пример #28
0
function rkv_menu_count()
{
    $primary = 'primary';
    $locations = get_nav_menu_locations();
    $menu_obj = get_term($locations[$primary], 'nav_menu');
    // Echo count of items in menu
    return $menu_obj->count;
}
Пример #29
-1
 function page_menu($menu_name)
 {
     if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
         $count = 0;
         $menu = wp_get_nav_menu_object($locations[$menu_name]);
         $menu_items = wp_get_nav_menu_items($menu->term_id);
         $menu_list = '<div class="portfolio_blocks">';
         foreach ((array) $menu_items as $key => $menu_item) {
             $count++;
             $menu_list .= '<div class="blocks_block">
                                 <div class="block_content">
                                     <figure class="block_content--image">
                                         ' . get_the_post_thumbnail($menu_item->object_id, 'full') . '
                                     </figure>
                                     <div class="block_content--heading">
                                         <h4 class="block_content--title">' . $menu_item->title . '</h4>
                                     </div>
                                     <a href="' . get_permalink($menu_item->object_id) . '" class="block_content--link"></a>
                                 </div>
                             </div>';
         }
         $menu_list .= '</div>';
     } else {
         $menu_list = '<ul><li>Menu "' . $menu_name . '" not defined.</li></ul>';
     }
     // $menu_list now ready to output
     echo $menu_list;
 }
Пример #30
-1
function seattlemennonite_section()
{
    $locations = get_nav_menu_locations();
    if (isset($locations['primary'])) {
        $menu = wp_get_nav_menu_object($locations['primary']);
        // Get an array of menu items.
        $menu_items = wp_get_nav_menu_items($menu->term_id);
        _wp_menu_item_classes_by_context($menu_items);
        // These classes indicate that this is the current menu item.
        $current_classes = array('current-menu-ancestor', 'current-menu-item', 'current-post-ancestor');
        // Create an array that maps the id of the menu item to
        // the item object.
        $map = array();
        foreach ((array) $menu_items as $key => $menu_item) {
            $map[$menu_item->db_id] = $menu_item;
        }
        unset($menu_items);
        // Loop through the menu items looking for the current one.
        foreach ($map as $key => $menu_item) {
            if (array_intersect($current_classes, $menu_item->classes)) {
                return seattlemennonite_get_section($map, $menu_item);
            }
        }
    }
}