/** * Build the custom CSS from the various arrays of CSS property/values * @return [type] [description] */ function ubermenu_generate_custom_styles() { $styles = array(); //Skin Generator //$skin_styles = ''; //$skin_styles = "\n/** UberMenu Skin Generator **/\n".$skin_styles; //$styles[10] = $skin_styles; //Responsive Styles $responsive_styles = ubermenu_custom_responsive_styles(); if ($responsive_styles) { $responsive_styles = "\n/** UberMenu Responsive Styles (Breakpoint Setting) **/\n" . $responsive_styles; $styles[10] = $responsive_styles; } //Menu Styles global $wp_customize; if (!isset($wp_customize)) { $menu_styles = ubermenu_generate_all_menu_styles(); if ($menu_styles) { $menu_styles = "\n/** UberMenu Custom Menu Styles (Customizer) **/\n" . $menu_styles; $styles[20] = $menu_styles; } } //Menu Item Styles $item_styles = ubermenu_generate_item_styles(); if ($item_styles) { $item_styles = "\n/** UberMenu Custom Menu Item Styles (Menu Item Settings) **/\n" . $item_styles; } $styles[30] = $item_styles; //Custom Styles $custom_styles = ubermenu_op('custom_tweaks', 'general'); if ($custom_styles) { $custom_styles = "\n/** UberMenu Custom Tweaks (General Settings) **/\n" . $custom_styles; $styles[50] = $custom_styles; } //Custom Styles - Mobile $custom_styles_mobile = ubermenu_op('custom_tweaks_mobile', 'general'); if ($custom_styles_mobile) { $max_width = ubermenu_op('responsive_breakpoint', 'general'); if (!$max_width) { $max_width = 959; } if (is_numeric($max_width)) { $max_width .= 'px'; } $custom_styles_mobile = "\n/** UberMenu Custom Tweaks - Mobile **/\n" . "@media screen and (max-width:" . $max_width . "){\n" . $custom_styles_mobile . "\n}"; $styles[60] = $custom_styles_mobile; } //Custom Styles - Desktop $custom_styles_desktop = ubermenu_op('custom_tweaks_desktop', 'general'); if ($custom_styles_desktop) { $min_width = ubermenu_op('responsive_breakpoint', 'general'); if (!$min_width) { $min_width = 960; } else { $min_width = $min_width + 1; } if (is_numeric($min_width)) { $min_width .= 'px'; } $custom_styles_desktop = "\n/** UberMenu Custom Tweaks - Desktop **/\n" . "@media screen and (min-width:" . $min_width . "){\n" . $custom_styles_desktop . "\n}"; $styles[100] = $custom_styles_desktop; } $styles = apply_filters('ubermenu_custom_styles', $styles); return implode("\n", $styles); }
function ubermenu_generate_all_menu_preview_styles() { $all_styles = array(); //$all_styles['main'] = ubermenu_generate_menu_preview_styles( 'main' ); $instances = ubermenu_get_menu_instances(true); foreach ($instances as $config_id) { $all_styles[$config_id] = ubermenu_generate_menu_preview_styles($config_id); } return ubermenu_generate_all_menu_styles($all_styles); }