function render_custom_widget_show($instance, $widget, $args) { if (isset($instance['metro_widget']) && $instance['metro_widget'] == '1') { $color = isset($instance['widget_color']) ? $instance['widget_color'] : ''; $bgcolor = $color != '' ? 'background-color:' . $color : ''; $text_class = $color != '' ? get_text_class($color) : ''; $args['before_widget'] = '<div class="widget_metro ' . $text_class . '" style="' . $bgcolor . '">' . $args['before_widget']; $args['after_widget'] = $args['after_widget'] . '</div>'; } $widget->widget($args, $instance); return false; }
function render_mega_nav($menu_location = 'primary') { $theme_locations = get_nav_menu_locations(); global $smof_data; $layout = isset($smof_data['header_layout']) ? $smof_data['header_layout'] : '1'; if (is_page() && tt_getmeta('customize_page') == '1') { $layout = tt_getmeta('header_layout'); } $menu_location = isset($theme_locations[$menu_location]) ? $menu_location : 'primary'; if (isset($theme_locations[$menu_location]) && (int) $theme_locations[$menu_location] > 0) { $menu_obj = get_term($theme_locations[$menu_location], 'nav_menu'); $menies = wp_get_nav_menu_items($menu_obj); if (!is_array($menies)) { return; } echo "<ul class='nav navbar-nav'>"; foreach ($menies as $meny) { if ($meny->menu_item_parent == 0) { $fullwidth = $meny->fullwidth == '1' ? 'fullwidth ' : ''; $fullwidth .= $meny->activemega == '1' ? 'mega-menu ' : ''; $li_style = ""; $color = $meny->color; $color = $color == '#fff' ? '#ffffff' : $color; $color = $color == '#000' ? '#000' : $color; $text_class = ''; $astyle = ''; if ($layout == '2') { $astyle = "background-color: {$color};"; $text_class = $color != '' ? get_text_class($color) : ''; } $text_class .= ' ' . get_current_menu_class($menies, $meny); $menu_childs = $meny->activemega == '1' ? render_megamenu_items($menies, $meny->ID, $meny) : render_submenu_items($menies, $meny->ID); $text_class .= $menu_childs != '' ? ' menu-item-has-children has-children' : ''; echo '<li id="' . get_menu_id($meny) . '" class="' . $fullwidth . $text_class . '" style="' . $li_style . '"> <a href="' . $meny->url . '" ' . get_custom_atts_menu($meny) . ' style="' . $astyle . '"> ' . get_icon_menu($meny) . ' ' . get_menu_text($meny) . ' ' . get_description_menu($meny) . ' </a> ' . $menu_childs . ' </li>'; } } // Nav menu items $args = array('theme_location' => $menu_location); $defaults = array('menu' => '', 'container' => 'div', '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' => '', 'theme_location' => ''); $args = wp_parse_args($args, $defaults); $args = apply_filters('wp_nav_menu_args', $args); $args = (object) $args; $nav_menu_items_hook = apply_filters('wp_nav_menu_items', '', $args); echo $nav_menu_items_hook; echo '</ul>'; } else { wp_nav_menu(array('theme_location' => 'primary', 'container_class' => 'mainmenu', 'fallback_cb' => 'metro_menu_callback')); } // Prints menu if user set menu on Mobile location $mobile = 'mobile-menu'; if (isset($theme_locations[$mobile]) && $theme_locations[$mobile] > 0) { wp_nav_menu(array('theme_location' => $mobile, 'container_id' => 'tt-mobile-menu', 'container_class' => 'hidden-xs hidden-sm hidden-md hidden-lg')); } }