function weaverx_generate_wphead() { /* this guy does ALL the work for generating theme look - it writes out the over-rides to the standard style.css */ global $weaverx_main_options, $weaverx_cur_page_ID; global $post; $weaverx_cur_page_ID = 0; // need this for 404 page when this is not valid if (is_object($post)) { $weaverx_cur_page_ID = get_the_ID(); } // we're on a page now, so set the post id for the rest of the session printf("\n<!-- This site is using %s %s (%s) subtheme: %s -->\n", WEAVERX_THEMENAME, WEAVERX_VERSION, weaverx_getopt('style_version'), weaverx_getopt('themename')); do_action('weaverxplus_show_version'); if (weaverx_use_inline_css(weaverx_get_css_filename())) { // generate inline CSS echo '<style type="text/css">' . "\n"; if (isset($_REQUEST['wp_customize'])) { // don't use cached CSS from customizer $css = ''; } else { $css = weaverx_getopt_default('wvrx_css_saved', ''); } if ($css == '' || $css[0] != '/') { // there isn't an entry in the DB, so do it on the fly require_once get_template_directory() . '/includes/generatecss.php'; // include only now at runtime. $output = weaverx_f_open('php://output', 'w+'); weaverx_output_style($output); } else { weaverx_echo_css($css); } echo "\n</style> <!-- end of main options style section -->\n"; } else { // include generated file $vers = weaverx_getopt('style_version'); if (!$vers) { $vers = '1'; } else { $vers = sprintf("%d", $vers); } wp_enqueue_style('weaverxp-style-sheet', weaverx_get_css_url(), array('weaver-root-style-sheet'), $vers); wp_enqueue_style('weaverxp-style-sheet'); } /* now head options */ weaverx_echo_css(weaverx_getopt('_althead_opts')); weaverx_echo_css(weaverx_getopt('head_opts')); /* let the user have the last word! */ $per_page_code = weaverx_get_per_page_value('page-head-code'); if (!empty($per_page_code)) { weaverx_echo_css($per_page_code); } if (weaverx_is_checked_page_opt('_pp_hide_site_title')) { /* best to just do this inline */ echo '<style type="text/css">#site-title,#site-tagline{display:none;}#nav-header-mini{margin-top:32px!important;}</style>' . "\n"; } if ($ppsb = weaverx_get_per_page_value('_pp_sidebar_width') > 0) { require_once get_template_directory() . '/includes/generatecss.php'; // include only now at runtime. $ppsb = weaverx_get_per_page_value('_pp_sidebar_width'); echo "<style type=\"text/css\"> /* Per Page Sidebar Width */\n"; weaverx_sidebar_style('echo', $ppsb); echo "</style>\n"; } echo "\n<!-- End of Weaver Xtreme options -->\n"; }
function weaverx_output_style($sout) { /* This outputs the CSS overrides. It will output to a file pointer, so it can write to a .css file saved in the user's upload directory - just like the saved style .wvr files. It is included via a standard css include. It needs to be loaded only for the admin page. */ global $wvrx_css_plus; $wvrx_css_plus = ''; weaverx_f_write($sout, sprintf("/* Weaver Xtreme styles - Version %s */\n", weaverx_getopt('style_version'))); // =========================== LINKS =============================== // Important. Links must come before any other rules that might define a tag - such as the menu bars, so just // put them here, near the top. weaverx_put_link($sout, 'link', 'a, .wrapper a', 'a:hover, .wrapper a:hover'); weaverx_put_link($sout, 'contentlink', '.content a', '.content a:hover'); weaverx_put_link($sout, 'ilink', '.wrapper .entry-meta a, .wrapper .entry-utility a', '.wrapper .entry-meta a:hover,.wrapper .entry-utility a:hover'); weaverx_put_link($sout, 'wlink', '.wrapper .widget a', '.wrapper .widget a:hover'); weaverx_put_link($sout, 'ibarlink', '#infobar a', '#infobar a:hover'); weaverx_put_link($sout, 'footerlink', '.colophon a', '.colophon a:hover'); // ========================= GENERAL APPEARANCE =============================== $b_c = weaverx_getopt_default('border_color', '#222'); //+ $b_w = weaverx_getopt_default('border_width_int', 1); $b_s = weaverx_getopt_default('border_style', 'solid'); $menus = array('m_primary' => '.menu-primary', 'm_secondary' => '.menu-secondary', 'm_extra' => '.menu-extra'); if ($b_c != '#222' || $b_w != 1 || $b_s != 'solid') { weaverx_f_write($sout, sprintf(".border {border:%dpx %s %s;}.border-bottom{border-bottom:%dpx %s %s;}\n", $b_w, $b_s, $b_c, $b_w, $b_s, $b_c)); } foreach ($menus as $id => $tag) { if (weaverx_getopt("{$id}_sub_border")) { weaverx_f_write($sout, sprintf(".is-desktop {$tag} ul ul,.is-desktop {$tag} ul.mega-menu li {border:%dpx %s %s;}\n.is-desktop {$tag} ul ul.mega-menu{border:none;}\n", $b_w, $b_s, $b_c)); } } /* rounded_corners */ $r = 8; $rm = 6; // rm for comments section $r = weaverx_getopt_default('rounded_corners_radius', 8); if ($r != 8) { if ($r >= 8) { $rm = (int) (0.75 * $r); } else { $rm = $r; } // It's time: no -moz or -webkit $rounded = '.rounded,.rounded-all,.rounded-custom{-moz-border-radius:8px !important; -webkit-border-radius:8px !important;border-radius:8px !important;} .rounded-top{-moz-border-radius-topleft:8px; -moz-border-radius-topright:8px;-webkit-border-top-left-radius:8px; -webkit-border-top-right-radius:8px;border-top-left-radius:8px; border-top-right-radius: 8px;} .rounded-bottom {-moz-border-radius-bottomleft:8px;-moz-border-radius-bottomright:8px;-webkit-border-bottom-left-radius:8px; -webkit-border-bottom-right-radius:8px;border-bottom-left-radius:8px; border-bottom-right-radius:8px;} .rounded-left{-moz-border-radius-topleft:8px;-moz-border-radius-bottomleft:8px;-webkit-border-top-left-radius:8px; -webkit-border-bottom-left-radius:8px;border-top-left-radius:8px;border-bottom-left-radius:8px;} .rounded-right{-moz-border-radius-topright:8px;-moz-border-radius-bottomright:8px;-webkit-border-top-right-radius:8px; -webkit-border-bottom-right-radius:8px;border-top-right-radius:8px;border-bottom-right-radius:8px;}'; weaverx_f_write($sout, str_replace('8', $rm, $rounded) . "\n"); } foreach ($menus as $id => $tag) { if (weaverx_getopt("{$id}_sub_rounded")) { // 3 kinds of rounding: whole box + hover, top sub-item, bottom sub-item $round_sub = str_replace('8', $r, "{-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;z-index:90;"); $menu = ".is-desktop {$tag} ul.sub-menu,.is-desktop {$tag} ul.children"; $mega = ".is-desktop {$tag} ul.mega-menu li"; $pad = (int) ($r - $r * 0.25); // pad it to avoid anchor bg from overwriting rounding $bg = weaverx_getopt("{$id}_sub_bgcolor"); if ($bg == '') { $bg = 'transparent'; } $round_end = "padding-top:{$pad}px;padding-bottom:{$pad}px;background-color:{$bg};}"; weaverx_f_write($sout, $menu . $round_sub . $round_end); weaverx_f_write($sout, $mega . $round_sub . "}\n"); } } /* fadebody_bg */ if (weaverx_getopt('fadebody_bg')) { weaverx_f_write($sout, sprintf("body {background-image: url(%s); background-attachment: scroll; background-repeat: repeat-x;}\n", weaverx_relative_url('assets/images/gr.png'))); } // ========================= LAYOUT / SIDEBAR AREAS =============================== if (($themew = weaverx_getopt_default('theme_width_int', 940)) != 940) { weaverx_f_write($sout, sprintf("#wrapper{max-width:%dpx;}\n", $themew)); } // =========================== HEADER OPTIONS =============================== weaverx_css_style_val($sout, '#site-title', '{max-width:%.5f%%;}', 'site_title_max_w'); weaverx_css_style_val($sout, '#site-tagline', '{max-width:%.5f%%;}', 'tagline_max_w'); /* Site Title/Description Site Title' => 'title_color' Title Position => 'site_title_position_xy' Move Title over Header Image => 'title_over_image' Site Description => 'desc_color' Description Position => 'tagline_xy' Header Extra HTML => 'header_html' */ $tx = weaverx_getopt_default('site_title_position_xy_X', 7); $ty = weaverx_getopt_default('site_title_position_xy_Y', 0); // new title margins if ($tx != 7 || $ty != 0) { if (is_rtl()) { weaverx_f_write($sout, sprintf("#site-title{margin-right:%.5f%% !important;margin-top:%.5f%% !important;}\n", $tx, $ty)); } else { weaverx_f_write($sout, sprintf("#site-title{margin-left:%.5f%% !important;margin-top:%.5f%% !important;}\n", $tx, $ty)); } } $tx = weaverx_getopt_default('tagline_xy_X', 10); $ty = weaverx_getopt_default('tagline_xy_Y', 0); // new title margins if ($tx != 10 || $ty != 0) { if (is_rtl()) { weaverx_f_write($sout, sprintf("#site-tagline{ margin-right:%.5f%% !important; margin-top:%.5f%% !important;}\n", $tx, $ty)); } else { weaverx_f_write($sout, sprintf("#site-tagline{ margin-left:%.5f%% !important; margin-top:%.5f%% !important;}\n", $tx, $ty)); } } $align = weaverx_getopt_default('header_image_align', 'float-left'); // alignment if (weaverx_getopt('link_site_image') && $align != 'center') { // normally, we use display:block on the image to make it align, etc, but that makes the link // extend over the whole column... So, we will use alternate layout for linked left/right align, and let center just be wrong. if ($align == 'float-left') { weaverx_f_write($sout, '#branding #header-image img{display:inline-block;float:left;}'); } else { weaverx_f_write($sout, '#branding #header-image img{display:inline-block;float:right;}'); } } else { if (($align = weaverx_getopt_default('header_image_align', 'float-left')) != 'float-left') { if ($align == 'center') { weaverx_f_write($sout, '#branding #header-image img{margin-left:auto;margin-right:auto;}'); } else { weaverx_f_write($sout, '#branding #header-image img{margin-left:auto;margin-right:0;}'); } } } if (weaverx_getopt('header_actual_size')) { weaverx_f_write($sout, '#branding #header-image img,html.ie8 #branding #header-image img {width:auto;}'); } if ($val = weaverx_getopt('header_image_max_width_dec')) { weaverx_f_write($sout, sprintf("#branding #header-image img{max-width:%.5f%%;}\n", $val)); weaverx_f_write($sout, sprintf("html.ie8 #branding #header-image img{width:%.5f%%;}\n", $val)); } if (($align = weaverx_getopt_default('header_html_align', 'float-left')) == 'center') { //$hwidth = weaverx_getopt_default( 'header_html_width_int', '100'); //$lm = (100.0 - $hwidth ) / 2.0; //weaverx_f_write($sout, sprintf("#header-html {margin-left:%.5f%%;}\n",$lm )); weaverx_f_write($sout, "#header-html {display:block !important;}\n"); } if (($align = weaverx_getopt_default('footer_html_align', 'float-left')) == 'center') { /* $hwidth = weaverx_getopt_default( 'footer_html_width_int', '100'); $lm = (100.0 - $hwidth ) / 2.0; weaverx_f_write($sout, sprintf("#footer-html {margin-left:%.5f%%;}\n",$lm )); */ weaverx_f_write($sout, "#gootrt-html {display:block !important;}\n"); } if (weaverx_getopt_default('header_html_center_content')) { weaverx_f_write($sout, "#header-html {text-align:center;}\n"); } if (weaverx_getopt_default('footer_html_center_content')) { weaverx_f_write($sout, "#footer-html {text-align:center;}\n"); } // =========================== MENU OPTIONS =============================== /* text_color = 0.213 * this.rgb[0] + 0.715 * this.rgb[1] + 0.072 * this.rgb[2] < 0.5 ? '#FFF' : '#000'; */ $cur_page = weaverx_getopt('menubar_curpage_noancestors') ? '.weaverx-theme-menu .current_page_item > a,.weaverx-theme-menu .current-menu-item > a,.weaverx-theme-menu .current-cat > a' : '.weaverx-theme-menu .current_page_item > a,.weaverx-theme-menu .current-menu-item > a,.weaverx-theme-menu .current-cat > a,.weaverx-theme-menu .current_page_ancestor > a,' . '.weaverx-theme-menu .current-category-ancestor > a,.weaverx-theme-menu .current-menu-ancestor > a,.weaverx-theme-menu .current-menu-parent > a,.weaverx-theme-menu .current-category-parent > a'; weaverx_put_color($sout, 'menubar_curpage_color', $cur_page, true); // menubar_curpage_color weaverx_put_bgcolor($sout, 'menubar_curpage_bgcolor', $cur_page, true); weaverx_put_rule_if_checked($sout, 'menubar_curpage_em', $cur_page . '{font-style:italic}'); // menubar_curpage_em weaverx_put_rule_if_checked($sout, 'menubar_curpage_bold', $cur_page . '{font-weight:bold}'); // =========================== CONTENT AREAS =============================== // Images if (weaverx_getopt('restrict_img_border')) { $img_tag = '.comment-content img[height],.container img[class*="align"],.container img[class*="wp-image-"],.container img[class*="attachment-"],.container img.featured-image,.container img.avatar,.colophon img[class*="align"],.colophon img[class*="wp-image-"],.colophon img[class*="attachment-"],.colophon img.featured-image,.colophon img.avatar'; } else { $img_tag = '.container img, .colophon img'; } weaverx_css_style_val($sout, $img_tag, '{padding:%dpx;}', 'media_lib_border_int'); $img_w = weaverx_getopt('media_lib_border_int'); if ($img_w > 3) { $half = $img_w / 2 + 1; $small_border_tag = '.container .gallery-icon img,.container .gallery-thumb img,#content img.gallery-thumb,#content img.avatar'; weaverx_f_write($sout, sprintf("{$small_border_tag}{padding:{$half}px;}\n")); // make the thumbs smaller } if (weaverx_getopt_checked('show_img_shadows')) { weaverx_f_write($sout, $img_tag . '{-webkit-box-shadow: 0 0 4px 2px rgba(0,0,0,0.25);-moz-box-shadow: 0 0 4px 2px rgba(0,0,0,0.25);box-shadow: 0 0 4px 2px rgba(0,0,0,0.25);}' . "\n"); } weaverx_put_bgcolor($sout, 'media_lib_border_color', $img_tag); $val = weaverx_getopt('contentlist_bullet'); if ($val != '' && $val != 'disc') { weaverx_f_write($sout, sprintf("#content ul {list-style-type:%s;}\n", $val)); } weaverx_css_style_val($sout, '.entry-summary,.entry-content', '{padding-top:%.5fem;}', 'space_after_title_dec'); weaverx_css_style_val($sout, '#content p,#content ul,#content ol', '{margin-bottom:%.5fem;}', 'content_p_list_dec'); if (weaverx_getopt('hyphenate')) { weaverx_f_write($sout, '#content{-webkit-hyphens:auto;-moz-hyphens:auto;hyphens:auto;}'); } /* Comments */ weaverx_put_rule_if_checked($sout, 'form_allowed_tags', '#commentform .form-allowed-tags {display:block;}'); $b_c = weaverx_getopt('border_color'); // if (!$b_c) { $b_c = '#222'; } $b_w = weaverx_getopt('border_width_int'); // if (!$b_w) { $b_w = 1; } weaverx_put_rule_if_checked($sout, 'show_comment_borders', ".commentlist li.comment,#respond,.commentlist li.comment .comment-author img.avatar,.commentlist .comment.bypostauthor{border:{$b_w}px solid {$b_c};}.commentlist li.comment .comment-meta{border-bottom:1px solid {$b_c};}"); weaverx_put_rule_if_checked($sout, 'hide_comment_bubble', '#comments-title h3{background-image:none;padding-left:0px;}'); weaverx_put_rule_if_checked($sout, 'hide_comment_hr', 'hr.comments-hr {display:none;}'); weaverx_put_color($sout, 'comment_headings_color', '#comments-title h3, #comments-title h4, #respond h3'); weaverx_put_bgcolor($sout, 'comment_content_bgcolor', '.commentlist li.comment, #respond'); weaverx_put_bgcolor($sout, 'comment_submit_bgcolor', '#respond input#submit'); /* weaverx_tables */ $table = weaverx_getopt('weaverx_tables'); if ($table == 'wide') { // make backward compatible with 1.4 and before when Twenty Ten was default weaverx_f_write($sout, sprintf("#content table {border: 1px solid #e7e7e7;margin: 0 -1px 24px 0;text-align: left;width: 100%%;}\n#content tr th, #content thead th {color: #888;font-size: 12px;font-weight: bold;line-height: 18px;padding: 9px 24px;}\n#content tr td {border-style:none; border-top: 1px solid #e7e7e7; padding: 6px 24px;}\n#content tr.odd td {background: rgba(0,0,0,0.1);}\n")); //weaverx_f_write($sout,"#content tr.odd td{background:transparent;}\n"); } elseif ($table == 'bold') { weaverx_f_write($sout, sprintf("#content table {border: 2px solid #888;}\n#content tr th, #content thead th {font-weight: bold;}\n#content tr td {border: 1px solid #888;}\n")); } elseif ($table == 'noborders') { weaverx_f_write($sout, sprintf("#content table {border-style:none;}\n#content tr th, #content thead th {font-weight: bold;border-bottom: 1px solid #888;background-color:transparent;}\n#content tr td {border-style:none;}\n")); } elseif ($table == 'fullwidth') { weaverx_f_write($sout, sprintf("#content table {width:100%%;}\n#content tr th, #content thead th {font-weight:bold;}\n")); } elseif ($table == 'plain') { weaverx_f_write($sout, sprintf("#content table {border: 1px solid #888;text-align:left;margin: 0 0 0 0;width:auto;}\n#content tr th, #content thead th {color: inherit;background:none;font-weight:normal;line-height:normal;padding:4px;}\n#content tr td {border: 1px solid #888; padding:4px;}\n")); } /* caption_color */ weaverx_put_color($sout, 'caption_color', '.wp-caption p.wp-caption-text, #content .gallery .gallery-caption,.entry-attachment .entry-caption'); // =========================== POST SPECIFIC AREAS =============================== weaverx_put_rule_if_checked($sout, 'show_comments_closed', '.nocomments {display:block;}'); // single/post navigation links weaverx_put_rule_if_checked($sout, 'nav_show_first', '#nav-above{display:block;}'); // put this one first, so hide can override weaverx_put_rule_if_checked($sout, 'nav_hide_above', '#nav-above,.paged #nav-above{display:none;margin:0;}'); weaverx_put_rule_if_checked($sout, 'nav_hide_below', '#nav-below{display:none;margin:0;}'); if (weaverx_getopt('single_nav_style') == 'hide' || weaverx_getopt_checked('single_nav_hide_above')) { weaverx_f_write($sout, ".single #nav-above{display:none;margin:0;}\n"); } if (weaverx_getopt('single_nav_style') == 'hide' || weaverx_getopt_checked('single_nav_hide_below')) { weaverx_f_write($sout, ".single #nav-below{display:none;margin:0;}\n"); } $nav = weaverx_getopt('nav_style'); // paged can take more than 50% if ($nav == 'paged_left') { weaverx_f_write($sout, ".nav-previous {width:95%;}\n"); } if ($nav == 'paged_right') { weaverx_f_write($sout, ".nav-next {width:95%;}\n"); } weaverx_put_color($sout, 'post_icons_color', '.entry-meta-gicons .entry-date:before,.entry-meta-gicons .by-author:before,.entry-meta-gicons .cat-links:before,.entry-meta-gicons .tag-links:before,.entry-meta-gicons .comments-link:before,.entry-meta-gicons .permalink-icon:before'); weaverx_put_rule_if_checked($sout, 'post_hide_single_author', '.single-author .entry-meta .by-author {display:none;}'); if (($val = weaverx_getopt_default('post_avatar_int', 28)) != 28) { weaverx_f_write($sout, '.post-avatar img {max-width:' . $val . "px;}\n"); } // ============================== WIDGET AREAS =================================== $val = weaverx_getopt('widgetlist_bullet'); if ($val != '' && $val != 'disc') { weaverx_f_write($sout, sprintf(".widget ul {list-style-type:%s;}\n", $val)); } // ================================== FONTS ===================================== // 0.0625 assumes standard default font size of 16 $font_size = weaverx_getopt('site_fontsize_int'); if ($font_size) { weaverx_f_write($sout, sprintf("body{font-size:%.5fem;}\n", $font_size * 0.0625)); } $font_size = weaverx_getopt('site_fontsize_tablet_int'); if ($font_size) { weaverx_f_write($sout, sprintf('body.is-smalltablet{font-size:%.5fem;}', $font_size * 0.0625)); } $font_size = weaverx_getopt('site_fontsize_phone_int'); if ($font_size) { weaverx_f_write($sout, sprintf('body.is-phone{font-size:%.5fem;}', $font_size * 0.0625)); } if ($site_h = weaverx_getopt('site_line_height_dec')) { weaverx_f_write($sout, sprintf('body{line-height:%.5f;}', $site_h)); weaverx_f_write($sout, sprintf('.widget-area{line-height:%.5f;}', $site_h * 0.85)); } $space = weaverx_getopt('font_letter_spacing_global_dec'); if ($space && $space != 0) { weaverx_f_write($sout, sprintf("body{letter-spacing:%.5fem;}\n", $space)); } $space = weaverx_getopt('font_letter_spacing_global_dec'); if ($space && $space != 0) { weaverx_f_write($sout, sprintf("body{word-spacing:%.5fem;}\n", $space)); } // ============================== CUSTOM OPTIONS ================================= if ($val = weaverx_getopt('custom_fontsize_a')) { weaverx_f_write($sout, '.customA-font-size{font-size:' . $val . 'em;}'); weaverx_f_write($sout, sprintf('.customA-font-size-title{font-size:%.5fem;}', $val * 1.5)); } if ($val = weaverx_getopt('custom_fontsize_b')) { weaverx_f_write($sout, '.customB-font-size{font-size:' . $val . 'em;}'); weaverx_f_write($sout, sprintf('.customB-font-size-title{font-size:%.5fem;}', $val * 1.5)); } if ($val = weaverx_getopt('custom_shadow')) { weaverx_f_write($sout, '.shadow-custom ' . weaverx_fix_braces($val)); } // ================================ AREAS ======================================== weaverx_put_bgcolor($sout, 'body_bgcolor', 'body'); // start with the body colors/css+ weaverx_put_bgcolor($sout, 'title_tagline_bgcolor', '#title-tagline'); $menu_bars = array('m_primary' => '.menu-primary .wvrx-menu-container', 'm_secondary' => '.menu-secondary .wvrx-menu-container', 'm_extra' => '.menu-extra .wvrx-menu-container', 'm_primary_sub' => '.menu-primary .wvrx-menu ul li a,.menu-primary .wvrx-menu ul.mega-menu li', 'm_secondary_sub' => '.menu-secondary .wvrx-menu ul li a,.menu-secondary .wvrx-menu ul.mega-menu li', 'm_extra_sub' => '.menu-extra .wvrx-menu ul li a,.menu-extra .wvrx-menu ul.mega-menu li'); $menu_links_bg = array('m_primary' => '.menu-primary .wvrx-menu > li > a', 'm_secondary' => '.menu-secondary .wvrx-menu > li > a', 'm_extra' => '.menu-extra .wvrx-menu > li > a'); $menu_links = array('m_primary' => '.menu-primary .wvrx-menu > li > a', 'm_secondary' => '.menu-secondary .wvrx-menu > li > a', 'm_extra' => '.menu-extra .wvrx-menu > li > a', 'm_primary_sub' => '.menu-primary .wvrx-menu ul li a', 'm_secondary_sub' => '.menu-secondary .wvrx-menu ul li a', 'm_extra_sub' => '.menu-extra .wvrx-menu ul li a'); $menu_detail = array('m_primary' => '.menu-primary', 'm_secondary' => '.menu-secondary', 'm_extra' => '.menu-extra'); // =Menus ------------------------------------------------------------ foreach ($menu_bars as $id => $tag) { weaverx_put_bgcolor($sout, $id . '_bgcolor', $tag); weaverx_put_color($sout, $id . '_color', $tag); } foreach ($menu_links_bg as $id => $tag) { weaverx_put_bgcolor($sout, $id . '_link_bgcolor', $tag); } foreach ($menu_links as $id => $tag) { weaverx_put_color($sout, $id . '_color', $tag); weaverx_put_color($sout, $id . '_hover_color', $tag . ':hover', true); if (weaverx_getopt('m_retain_hover') && strpos($id, '_sub') === false) { $rule = str_replace('> li', 'li:hover', $tag); weaverx_put_bgcolor($sout, $id . '_hover_bgcolor', $rule, true); } else { weaverx_put_bgcolor($sout, $id . '_hover_bgcolor', $tag . ':hover', true); // important to override current item bg } } foreach ($menu_detail as $id => $tag) { weaverx_put_color($sout, $id . '_color', $tag . ' .menu-toggle-button'); weaverx_put_color($sout, $id . '_html_color', $tag . ' .wvrx-menu-html'); // Extra menu HTML Left/Right $val = weaverx_getopt($id . '_html_margin_dec'); if ($val) { weaverx_f_write($sout, sprintf($tag . " .wvrx-menu-html{margin-top:%.5fem;}\n", $val)); } else { $font_size = weaverx_getopt($id . '_font_size'); // generate new top margin based on font_size switch ($font_size) { case 'xxs-font-size': weaverx_f_write($sout, $tag . " .wvrx-menu-html{margin-top:.375em;}\n"); break; case 'xs-font-size': weaverx_f_write($sout, $tag . " .wvrx-menu-html{margin-top:.425em;}\n"); break; case 's-font-size': weaverx_f_write($sout, $tag . " .wvrx-menu-html{margin-top:.5em;}\n"); break; case 'l-font-size': weaverx_f_write($sout, $tag . " .wvrx-menu-html{margin-top:.425em;}\n"); break; case 'xl-font-size': weaverx_f_write($sout, $tag . " .wvrx-menu-html{margin-top:.425em;}\n"); break; case 'xxl-font-size': weaverx_f_write($sout, $tag . " .wvrx-menu-html{margin-top:.425em;}\n"); break; default: break; } } // padding $pad = weaverx_getopt($id . '_menu_pad_dec'); $dcolor = weaverx_getopt($id . '_dividers_color'); $rpad = weaverx_getopt($id . '_right_padding_dec'); $hide_arrows = weaverx_getopt($id . '_hide_arrows'); weaverx_f_write($sout, "@media(min-width:768px) {\n"); // following are really .is-desktop. Note last align rule has closing } if ($pad != '') { weaverx_f_write($sout, sprintf("{$tag} .wvrx-menu a{padding-top:%.5fem;padding-bottom:%.5fem;}\n", $pad, $pad)); if ($pad > 1.9) { // arrows need adjustments - these are for Genericons weaverx_f_write($sout, sprintf("{$tag} .menu-arrows .toggle-submenu:after{top:%.5fem;}\n", $pad + 1.2)); } else { if ($pad > 0.6) { weaverx_f_write($sout, sprintf("{$tag} .menu-arrows .toggle-submenu:after{top:%.5fem;}\n", $pad + 0.75)); } else { if ($pad < 0.6) { weaverx_f_write($sout, sprintf("{$tag} .menu-arrows .toggle-submenu:after{top:%.5fem;}\n", $pad + 0.5)); } } } } // dividers if ($dcolor != '') { weaverx_f_write($sout, "{$tag} .wvrx-menu a{border-right:1px solid {$dcolor};}\n"); weaverx_f_write($sout, "{$tag} ul.wvrx-menu > li:first-child {border-left:1px solid {$dcolor};}\n"); // only desktop? weaverx_f_write($sout, "{$tag} .wvrx-menu ul > li:first-child{border-top:1px solid {$dcolor};}\n"); weaverx_f_write($sout, "{$tag} .wvrx-menu ul a {border-top:none;border-left:none;border-right:none;border-bottom:1px solid {$dcolor};}\n"); } // menu padding if ($rpad != '') { $rpad_arrow = $rpad + 1.5; weaverx_f_write($sout, "{$tag} .wvrx-menu-container li a{padding-right:{$rpad}em;}\n"); weaverx_f_write($sout, "{$tag} .menu-hover.menu-arrows .has-submenu > a{padding-right:{$rpad_arrow}em;}\n"); weaverx_f_write($sout, "{$tag} .menu-arrows.menu-hover .toggle-submenu{margin-right:{$rpad}em;}\n"); } // menu margins $mtop = weaverx_getopt($id . '_top_margin_dec'); $mbot = weaverx_getopt($id . '_bottom_margin_dec'); if ($mtop != '') { weaverx_f_write($sout, "{$tag} .wvrx-menu-container{margin-top:{$mtop}px;}\n"); } if ($mbot != '') { weaverx_f_write($sout, "{$tag} .wvrx-menu-container{margin-bottom:{$mbottom}px;}\n"); } // Menu Arrows if ($hide_arrows) { weaverx_f_write($sout, "{$tag} .menu-arrows .toggle-submenu:after{content:'';display:none;}\n"); //.is-deskotp {$tag} .wvrx-menu a span.sub-arrow:after{display:none;}\n"); if ($rpad == '') { weaverx_f_write($sout, "{$tag} .menu-hover.menu-arrows .has-submenu > a {padding-right:0.75em;}\n"); } weaverx_f_write($sout, "{$tag} .wvrx-menu a span.sub-arrow:after{display:none;}\n"); } // special case - generate a .wvrx-menu text align for main menus to get rid of initial menu jumping $align = weaverx_getopt_default("{$id}_align", 'left'); $lh = ''; if ($align == 'center') { // compensate for centered display:inline-block $lh = 'line-height:0;'; } weaverx_f_write($sout, "{$tag} .wvrx-menu,{$tag} .wvrx-menu-container{text-align:{$align};{$lh}}\n}\n"); // NOTE! Has @media close } $color = weaverx_getopt($id . '_color'); if ($color) { weaverx_f_write($sout, sprintf("{$tag} .menu-arrows .toggle-submenu:after{color:{$color};}\n")); weaverx_f_write($sout, sprintf("{$tag} .menu-arrows ul .toggle-submenu:after{color:{$color};}\n")); weaverx_f_write($sout, sprintf("{$tag} .menu-arrows.is-mobile-menu.menu-arrows ul a .toggle-submenu:after{color:{$color};}\n")); } $color = weaverx_getopt("{$id}_sub_color"); // sub-menu arrow takes special handling to override if ($color) { weaverx_f_write($sout, sprintf("{$tag} .menu-arrows ul .toggle-submenu:after{color:{$color};}\n")); } // alternative mobile menu arrow clickable weaverx_put_bgcolor($sout, $id . '_clickable_bgcolor', "{$tag} .is-mobile-menu.menu-arrows .toggle-submenu"); } // End of Menus // =Search ------------------------------------------------------------ if (($val = weaverx_getopt_default('search_icon', 'gray-bg')) != 'gray-bg') { $icon = weaverx_relative_url('assets/css/icons/search-' . $val . '.png'); weaverx_f_write($sout, '.search-field {background-image: url(' . $icon . ");}\n"); } $search_bg = weaverx_getopt('search_bgcolor'); if ($search_bg) { weaverx_put_bgcolor($sout, 'search_bgcolor', '.search-field'); // general search bg weaverx_f_write($sout, '#header-search .search-field:focus{background-color:' . $search_bg . ";}\n"); } // End of Menus // ================================ MARGINS/PADDING/SMART WIDGETS =================================== /* * .l-content {width:100%;} .l-content-m {width:98%;margin-left:1%;margin-right:1%;} .l-sb-left, .l-sb-right, .l-sb-left-split, .l-sb-right-split {width:25%;} .l-sb-left-lm, .l-sb-right-lm, .l-sb-left-split-lm, .l-sb-right-split-lm {width:24%;margin-left:1%;} .l-sb-left-rm, .l-sb-right-rm, .l-sb-left-split-rm, .l-sb-right-split-rm {width:24%;margin-right:1%;} .l-widget-area-top, .l-widget-area-bottom {width:100%;} */ // smart -lm, -rm, -m : value is 'smart_margin_int' $smart = weaverx_getopt_default('smart_margin_int', 1); if ($smart > 25) { $smart = 1; } // some sanity check if ($smart != 1) { for ($i = 2; $i <= 8; $i++) { $w = 99.9999 / $i - $smart + $smart / $i; // 99.9999 just a little rounding fudge factor */ weaverx_f_write($sout, sprintf(".is-desktop .per-row-%d-m{width:%.5f%%;}", $i, $w)); } weaverx_f_write($sout, sprintf(".is-smalltablet .per-row-2-m,.is-smalltablet .per-row-3-m,.is-smalltablet .per-row-4-m,.is-smalltablet .per-row-5-m,.is-smalltablet .per-row-6-m,.is-smalltablet .per-row-7-m,.is-smalltablet .per-row-8-m{width:%.5f%%;}", 49.999 - $smart / 2.0)); weaverx_f_write($sout, "\n"); weaverx_f_write($sout, ".is-smalltablet .m-widget-smart-rm aside,.widget-smart-rm aside,.ie8 .smart-rm{margin-right:{$smart}%;}\n"); } weaverx_sidebar_style($sout); // generate sidebar style /* _bgcolor, _color : MUST BE AFTER OTHER AREA OPTIONS BECAUSE OF CSS+ */ $sb_areas = array('primary' => '#primary-widget-area', 'alt:primary' => '.widget-area-primary', 'secondary' => '#secondary-widget-area', 'alt:secondary' => '.widget-area-secondary', 'top' => '.widget-area-top', 'bottom' => '.widget-area-bottom', 'header' => '#header', 'header_html' => '#header-html', 'header_sb' => '#header-widget-area', 'alt:header_sb' => '.widget-area-header', 'footer' => '#colophon', 'footer_html' => '#footer-html', 'footer_sb' => '#footer-widget-area', 'alt:footer_sb' => '.widget-area-footer', 'content' => '#content', 'container' => '#container', 'infobar' => '#infobar', 'wrapper' => '#wrapper', 'post' => '.post-area', 'widget' => '.widget'); foreach ($sb_areas as $area => $tag) { $id = str_replace('alt:', '', $area); // allow double rules weaverx_put_bgcolor($sout, $id . '_bgcolor', $tag); weaverx_put_color($sout, $id . '_color', $tag); if ($area == 'content' || $area == 'post') { // #content is % instead of px weaverx_css_style_val($sout, $tag, '{padding-left:%.5f%%;}', $id . '_padding_L'); weaverx_css_style_val($sout, $tag, '{padding-right:%.5f%%;}', $id . '_padding_R'); } else { weaverx_css_style_val($sout, $tag, '{padding-left:%dpx;}', $id . '_padding_L'); weaverx_css_style_val($sout, $tag, '{padding-right:%dpx;}', $id . '_padding_R'); } weaverx_css_style_val($sout, $tag, '{padding-top:%dpx;}', $id . '_padding_T'); weaverx_css_style_val($sout, $tag, '{padding-bottom:%dpx;}', $id . '_padding_B'); weaverx_css_style_val($sout, $tag, '{margin-top:%dpx;}', $id . '_margin_T'); weaverx_css_style_val($sout, $tag, '{margin-bottom:%dpx;}', $id . '_margin_B'); } $max_w_areas = array('header' => '#header', 'footer' => '#colophon', 'container' => '#container', 'm_primary' => '.menu-primary', 'm_secondary' => '.menu-secondary', 'm_extra' => '.menu-extra'); foreach ($max_w_areas as $id => $tag) { $w = weaverx_getopt($id . '_max_width_int'); if ($w) { weaverx_f_write($sout, "{$tag}" . "{max-width:{$w}px;}\n"); } if ($xbg = weaverx_getopt($id . '_extend_bgcolor')) { $cname = "{$tag}"; weaverx_f_write($sout, "{$cname}{position:relative;overflow:visible;}\n{$cname}:before{content:'';position:absolute;top:0;bottom:0;left:-9998px;right:0;\nborder-left:9999px solid {$xbg};box-shadow:9999px 0 0 {$xbg};z-index:-1;}\n"); } } // custom widths for header, footer widget areas $hf_sb = array('_header_sb_' => '#header-widget-area', '_footer_sb_' => '#footer-widget-area', 'alt:_header_sb_' => '.widget-area-header', 'alt:_footer_sb_' => '.widget-area-footer', '_primary_' => '#primary-widget-area', '_secondary_' => '#secondary-widget-area', 'alt:_primary_' => '.widget-area-primary', 'alt:_secondary_' => '.widget-area-secondary', '_top_' => '.widget-area-top', '_bottom_' => '.widget-area-bottom'); $hf_sb_w = array('lw_' => '.is-desktop', 'mw_' => '.is-smalltablet', 'sw_' => '.is-phone'); $ie8_fixed = false; foreach ($hf_sb as $sb => $area) { // process each area with custom widget widths foreach ($hf_sb_w as $sb_w => $media) { // process each device $sb = str_replace('alt:', '', $sb); // Allow double rules $list = trim(weaverx_getopt($sb . $sb_w . 'cols_list')); if ($list == '') { continue; } $list = str_replace('%', '', $list); // kill %'s $list = str_replace(',', ' ', $list); // change ,'s to blanks $list = str_replace(' ;', ';', $list); // be sure the ; is right after the value $list = str_replace(';', '; ', $list); // be sure have space after ; $list = array_filter(explode(' ', $list), 'strlen'); // explode list, filter null strings if (empty($list)) { continue; } $m = $smart; if (weaverx_getopt(substr($area, 1) . '_no_widget_margins')) { // no margins? $m = 0; } weaverx_f_write($sout, "{$media} {$area} .widget {float:left;margin-left:0;margin-right:0}\n"); // reset previous list margins if ($media != '.is-phone' && !$ie8_fixed) { weaverx_f_write($sout, ".ie8 .is-desktop .begin-of-row,.ie8 .is-smalltablet .widget-odd{clear:none;}\n"); $ie8_fixed = true; } $clear = 'clear:both'; $i = 0; foreach ($list as $val) { // step through the list of values $i++; $w = str_replace(';', '', $val); // strip ; $at_end = $w != $val; // force end if was a ; before if ($w === '0') { // hide this widget weaverx_f_write($sout, $media . ' ' . $area . ' .widget-' . $i . "{display:none;}\n"); } else { if ($w) { if ($at_end) { // at end of row weaverx_f_write($sout, sprintf("{$media} %s .widget-%d{width:%.5f%%;}\n", $area, $i, $w, $clear)); $clear = 'clear:both;'; } else { weaverx_f_write($sout, sprintf("{$media} %s .widget-%d{width:%.5f%%;margin-right:%.5f%%;%s}\n", $area, $i, $w - $m, $m, $clear)); $clear = ''; } } } } } } // adjust mini-menu top margin based on hide title/tagline. Goes here so user can override with mini-menu bg css+ /* $hide_title = weaverx_getopt( 'hide_site_title' ); $hide_tag = weaverx_getopt( 'hide_site_tagline' ); if ( $hide_tag == 'hide' || $hide_title == 'hide' || strpos( $hide_tag, 'l-hide') !== false || strpos( $hide_title, 'l-hide') !== false) { weaverx_f_write( $sout, '#nav-header-mini{margin-top:34px;}' ); } */ // ================================ COLORS =================================== // Colors need to go last because they might have CSS + $titles = array('site_title' => '.wrapper #site-title a,.site-title a', 'tagline' => '#site-tagline,.site-tagline', 'page_title' => '.page-title', 'post_title' => '.wrapper .post-title', 'archive_title' => '.archive-title', 'widget_title' => '.widget-title', 'm_header_mini' => '#nav-header-mini', 'content_h' => '.entry-content h1,.entry-content h2,.entry-content h3,.entry-content h4,.entry-content h5,.entry-content h6'); foreach ($titles as $title => $rule) { weaverx_put_bgcolor($sout, $title . '_bgcolor', $rule); // bar under some titles if ($val = (int) weaverx_getopt($title . '_underline_int')) { $titleColor = weaverx_getopt($title . '_color'); if ($titleColor == '' || $titleColor == 'inherit') { $titleColor = weaverx_getopt('content_color'); } // content_color, etc, colors are generated by $area . '_color' if ($titleColor == '' || $titleColor == 'inherit') { $titleColor = weaverx_getopt('container_color'); } if ($titleColor == '' || $titleColor == 'inherit') { $titleColor = weaverx_getopt('wrapper_color'); } if ($titleColor == '' || $titleColor == 'inherit') { $titleColor = '#222'; } /* if they want a border, this is the fallback color */ weaverx_f_write($sout, sprintf($rule . "{border-bottom: {$val}px solid {$titleColor};}\n")); } if ($title == 'content_h') { // these aren't handled by adding a style weaverx_put_rule_if_checked($sout, $title . '_normal', $rule . '{font-weight:normal !important;}'); // not bold? $val = weaverx_getopt($title . '_italic'); if ($val == 'on') { weaverx_f_write($sout, "{$rule}{font-style:italic;}\n"); } else { if ($val == 'off') { weaverx_f_write($sout, "{$rule}{font-style:normal;}\n"); } } } if ($title == 'post_title' || $title == 'm_header_mini') { // stupid special cases because want the bg to work right ... $rule = $rule . ' a,' . $rule . ' a:visited'; } weaverx_put_color($sout, $title . '_color', $rule); } weaverx_put_color($sout, 'post_title_hover_color', '.wrapper .post-title a:hover'); weaverx_put_color($sout, 'm_header_mini_hover_color', '#nav-header-mini a:hover'); $val = weaverx_getopt('m_header_mini_top_margin_dec'); if ($val != '') { weaverx_f_write($sout, sprintf("#nav-header-mini{margin-top:%.5fem}\n", $val)); } weaverx_put_bgcolor($sout, 'stickypost_bgcolor', '.blog .sticky'); weaverx_put_bgcolor($sout, 'post_author_bgcolor', '#author-info'); weaverx_put_bgcolor($sout, 'hr_color', 'hr'); weaverx_put_bgcolor($sout, 'post_info_top_bgcolor', '.entry-meta'); weaverx_put_color($sout, 'post_info_top_color', '.entry-meta'); weaverx_put_bgcolor($sout, 'post_info_bottom_bgcolor', '.entry-utility'); weaverx_put_color($sout, 'post_info_bottom_color', '.entry-utility'); weaverx_put_bgcolor($sout, 'input_bgcolor', 'input,textarea'); weaverx_put_color($sout, 'input_color', 'input,textarea'); weaverx_put_bgcolor($sout, 'search_bgcolor', '.search-field,#header-search .search-field:focus'); weaverx_put_color($sout, 'search_color', '.search-field,#header-search .search-field:focus'); // =============================== TITLES ================================== // injection area bg colors $htmls = array('preheader', 'header', 'prewrapper', 'container_top', 'precontent', 'postpostcontent', 'precomments', 'pagecontentbottom', 'postcomments', 'prefooter', 'postfooter', 'presidebar', 'fixedtop', 'fixedbottom', 'postheader'); foreach ($htmls as $val) { // includes areas from Weaver Xtreme Plus, too. $prefix = $val == 'postpostcontent' ? '.' : '#'; weaverx_put_bgcolor($sout, 'inject_' . $val . '_bgcolor', $prefix . 'inject_' . $val); } if ($val = weaverx_getopt('post_title_bottom_margin_dec')) { weaverx_f_write($sout, ".post-title{margin-bottom:{$val}em;}\n"); } if ($themew != 940) { weaverx_f_write($sout, "#inject_fixedtop,#inject_fixedbottom{max-width:{$themew}px;}\n"); weaverx_f_write($sout, ".ie8 #inject_fixedtop,.ie8 #inject_fixedbottom{max-width:{$themew}px;}\n"); } // ================================ END RULES =================================== // These rules need to be at the end if (weaverx_getopt('reset_content_opts')) { weaverx_f_write($sout, ".has-posts #content {border:none; -moz-box-shadow: none; -webkit-box-shadow:none; box-shadow: none;background:transparent;padding:0;margin-top:0;margin-bottom:0;}\n"); } // ================================ PRO AREAS =================================== do_action('weaverxplus_css', $sout); if (is_customize_preview()) { // wrap these guys in ids so can more easily manipulate the DOM // always generate the <style> block so will be there to manipulate weaverx_f_write($sout, "\n</style>\n"); weaverx_f_write($sout, "\n<style id='wvrx-css-plus' type='text/css'> /* CSS+ Rules */\n"); weaverx_f_write($sout, $wvrx_css_plus); weaverx_f_write($sout, "\n</style>\n"); $add_css = weaverx_getopt('add_css'); weaverx_f_write($sout, "\n<style id='wvrx-global-css' type='text/css'> /* Global CSS Rules */\n"); weaverx_f_write($sout, apply_filters('weaverx_css', $add_css)); //weaverx_f_write($sout, "\n</style>\n"); } else { // standard site - only output CSS if really there if ($wvrx_css_plus != '') { weaverx_f_write($sout, "\n/* CSS+ Rules */\n"); weaverx_f_write($sout, $wvrx_css_plus); } $add_css = weaverx_getopt('add_css'); if (!empty($add_css)) { weaverx_f_write($sout, "\n/* Global Custom CSS Rules */\n"); weaverx_f_write($sout, apply_filters('weaverx_css', $add_css)); } } weaverx_f_write($sout, "\n/* End Weaver Xtreme CSS */\n"); }