| @@ -1238,8 +1238,65 @@ | ||
| 1238 | 1238 | //Doc Layout 7 Controls End |
| 1239 | 1239 | |
| 1240 | 1240 | /** Single Doc Start **/ |
| 1241 | 1241 | |
| 1242 | +/** | |
| 1243 | + * Single Doc Content Area Width / Maximum Width. | |
| 1244 | + * | |
| 1245 | + * One pair of settings, three selectors — each layout family caps its content | |
| 1246 | + * wrapper through a different rule in the stylesheet, so the override has to | |
| 1247 | + * match the rule it is replacing: | |
| 1248 | + * | |
| 1249 | + * layouts 8 / 9 / 10 .betterdocs-wrapper.betterdocs-single-layout-8 ... | |
| 1250 | + * (9 and 10 also carry the layout-8 class) | |
| 1251 | + * layouts 1 / 6 ...:not(.betterdocs-fluid-wrapper) — these two are the | |
| 1252 | + * only single layouts without the fluid class | |
| 1253 | + * layout 5 .betterdocs-single-layout-5 ... | |
| 1254 | + * | |
| 1255 | + * The 1/6 selector is additionally scoped to .betterdocs-single-wrapper: the | |
| 1256 | + * docs-archive and category-archive wrappers are also non-fluid, and they have | |
| 1257 | + * their own width controls (betterdocs_doc_page_content_* / | |
| 1258 | + * betterdocs_archive_content_area_*) that this would otherwise override. | |
| 1259 | + * | |
| 1260 | + * Layouts 2, 3 and 4 are deliberately absent — they are full-bleed and both | |
| 1261 | + * controls are hidden for them in customizer-condition.js. | |
| 1262 | + */ | |
| 1263 | +/** | |
| 1264 | + * Each selector is prefixed with `body` purely to win the cascade. The base | |
| 1265 | + * caps live in common/_normalizer.scss and templates/single.scss, which are | |
| 1266 | + * @imported into a dozen front-end bundles (single.css, article-summary.css, | |
| 1267 | + * category-grid.css, reactions.css, …), so the identical 0,3,0 rule is emitted | |
| 1268 | + * many times over and several of those stylesheets load *after* this inline | |
| 1269 | + * block in wp_head. At equal specificity the last one would win and the | |
| 1270 | + * setting would silently do nothing. One element selector takes us to 0,3,1 | |
| 1271 | + * and beats every copy without resorting to !important. | |
| 1272 | + */ | |
| 1273 | +$betterdocs_single_content_width_selectors = [ | |
| 1274 | + 'body .betterdocs-wrapper.betterdocs-single-layout-8 .betterdocs-content-wrapper', | |
| 1275 | + 'body .betterdocs-wrapper.betterdocs-single-wrapper:not(.betterdocs-fluid-wrapper) .betterdocs-content-wrapper', | |
| 1276 | + 'body .betterdocs-single-layout-5 .betterdocs-content-wrapper' | |
| 1277 | +]; | |
| 1278 | + | |
| 1279 | +$css->add_rule( | |
| 1280 | + $betterdocs_single_content_width_selectors, | |
| 1281 | + $css->properties( | |
| 1282 | + [ | |
| 1283 | + 'width' => 'betterdocs_single_doc_content_width' | |
| 1284 | + ], | |
| 1285 | + '%' | |
| 1286 | + ) | |
| 1287 | +); | |
| 1288 | + | |
| 1289 | +$css->add_rule( | |
| 1290 | + $betterdocs_single_content_width_selectors, | |
| 1291 | + $css->properties( | |
| 1292 | + [ | |
| 1293 | + 'max-width' => 'betterdocs_single_doc_content_max_width' | |
| 1294 | + ], | |
| 1295 | + 'px' | |
| 1296 | + ) | |
| 1297 | +); | |
| 1298 | + | |
| 1242 | 1299 | //Single Doc Common Controllers Content Area Background Color |
| 1243 | 1300 | $css->add_rule( |
| 1244 | 1301 | '.betterdocs-wrapper.betterdocs-single-wrapper .betterdocs-content-wrapper', |
| 1245 | 1302 | $css->properties( |
| @@ -9656,8 +9713,180 @@ | ||
| 9656 | 9713 | '.betterdocs-docs-archive-wrapper .betterdocs-faq-wrapper.betterdocs-faq-layout-1 .betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group .betterdocs-faq-main-content', |
| 9657 | 9714 | $css->properties( |
| 9658 | 9715 | [ |
| 9659 | 9716 | 'font-size' => 'betterdocs_faq_list_content_font_size' |
| 9717 | + ], | |
| 9718 | + 'px' | |
| 9719 | + ) | |
| 9720 | +); | |
| 9721 | + | |
| 9722 | +/** | |
| 9723 | + * Product FAQ for WooCommerce Customizer CSS | |
| 9724 | + * | |
| 9725 | + * Targets the product-page FAQ wrapper (`.betterdocs-woo-product-faq`), which | |
| 9726 | + * reuses the shared faq parts, so a single control set styles the Group Title | |
| 9727 | + * + FAQ List for whichever layout (1–3) the product FAQ uses. | |
| 9728 | + * | |
| 9729 | + * Note on specificity: the static front-end faq.css is enqueued during product | |
| 9730 | + * render and printed in the footer — i.e. AFTER this inline <style> — and its | |
| 9731 | + * layout-scoped rules reach (0,7,1). To win regardless of source order each | |
| 9732 | + * selector includes the product layout class (`.betterdocs-faq-layout-{1,2,3}`) | |
| 9733 | + * so it out-specifies the static rule rather than relying on cascade order. | |
| 9734 | + */ | |
| 9735 | +$woo_faq_selector = function ( $suffix ) { | |
| 9736 | + $prefixes = [ | |
| 9737 | + '.betterdocs-faq-wrapper.betterdocs-woo-product-faq.betterdocs-faq-layout-1', | |
| 9738 | + '.betterdocs-faq-wrapper.betterdocs-woo-product-faq.betterdocs-faq-layout-2', | |
| 9739 | + '.betterdocs-faq-wrapper.betterdocs-woo-product-faq.betterdocs-faq-layout-3' | |
| 9740 | + ]; | |
| 9741 | + | |
| 9742 | + return implode( | |
| 9743 | + ', ', | |
| 9744 | + array_map( | |
| 9745 | + function ( $prefix ) use ( $suffix ) { | |
| 9746 | + return $prefix . ' ' . $suffix; | |
| 9747 | + }, | |
| 9748 | + $prefixes | |
| 9749 | + ) | |
| 9750 | + ); | |
| 9751 | +}; | |
| 9752 | + | |
| 9753 | +// Group Title. | |
| 9754 | +$css->add_rule( | |
| 9755 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-title .betterdocs-faq-title-tag' ), | |
| 9756 | + $css->properties( | |
| 9757 | + [ | |
| 9758 | + 'color' => 'betterdocs_faq_category_title_color_woo' | |
| 9759 | + ] | |
| 9760 | + ) | |
| 9761 | +); | |
| 9762 | + | |
| 9763 | +$css->add_rule( | |
| 9764 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-title .betterdocs-faq-title-tag' ), | |
| 9765 | + $css->properties( | |
| 9766 | + [ | |
| 9767 | + 'font-size' => 'betterdocs_faq_category_name_font_size_woo' | |
| 9768 | + ], | |
| 9769 | + 'px' | |
| 9770 | + ) | |
| 9771 | +); | |
| 9772 | + | |
| 9773 | +$css->add_rule( | |
| 9774 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-title .betterdocs-faq-title-tag' ), | |
| 9775 | + $css->properties( | |
| 9776 | + [ | |
| 9777 | + 'padding' => 'betterdocs_faq_category_name_padding_woo' | |
| 9778 | + ], | |
| 9779 | + 'px' | |
| 9780 | + ) | |
| 9781 | +); | |
| 9782 | + | |
| 9783 | +// FAQ List — question row. | |
| 9784 | +$css->add_rule( | |
| 9785 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group .betterdocs-faq-post .betterdocs-faq-post-name' ), | |
| 9786 | + $css->properties( | |
| 9787 | + [ | |
| 9788 | + 'color' => 'betterdocs_faq_list_color_woo' | |
| 9789 | + ] | |
| 9790 | + ) | |
| 9791 | +); | |
| 9792 | + | |
| 9793 | +$css->add_rule( | |
| 9794 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group .betterdocs-faq-post .betterdocs-faq-post-name' ), | |
| 9795 | + $css->properties( | |
| 9796 | + [ | |
| 9797 | + 'font-size' => 'betterdocs_faq_list_font_size_woo' | |
| 9798 | + ], | |
| 9799 | + 'px' | |
| 9800 | + ) | |
| 9801 | +); | |
| 9802 | + | |
| 9803 | +$css->add_rule( | |
| 9804 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group .betterdocs-faq-post' ), | |
| 9805 | + $css->properties( | |
| 9806 | + [ | |
| 9807 | + 'background-color' => 'betterdocs_faq_list_background_color_woo' | |
| 9808 | + ] | |
| 9809 | + ) | |
| 9810 | +); | |
| 9811 | + | |
| 9812 | +$css->add_rule( | |
| 9813 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group .betterdocs-faq-post' ), | |
| 9814 | + $css->properties( | |
| 9815 | + [ | |
| 9816 | + 'padding' => 'betterdocs_faq_list_padding_woo' | |
| 9817 | + ], | |
| 9818 | + 'px' | |
| 9819 | + ) | |
| 9820 | +); | |
| 9821 | + | |
| 9822 | +// FAQ List — answer content. | |
| 9823 | +$css->add_rule( | |
| 9824 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group .betterdocs-faq-main-content' ), | |
| 9825 | + $css->properties( | |
| 9826 | + [ | |
| 9827 | + 'background-color' => 'betterdocs_faq_list_content_background_color_woo', | |
| 9828 | + 'color' => 'betterdocs_faq_list_content_color_woo' | |
| 9829 | + ] | |
| 9830 | + ) | |
| 9831 | +); | |
| 9832 | + | |
| 9833 | +$css->add_rule( | |
| 9834 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group .betterdocs-faq-main-content' ), | |
| 9835 | + $css->properties( | |
| 9836 | + [ | |
| 9837 | + 'font-size' => 'betterdocs_faq_list_content_font_size_woo' | |
| 9838 | + ], | |
| 9839 | + 'px' | |
| 9840 | + ) | |
| 9841 | +); | |
| 9842 | + | |
| 9843 | +// FAQ Group wrapper (the accordion item). border-style is emitted as a literal | |
| 9844 | +// so the border renders on every product layout once a width is set (the static | |
| 9845 | +// border is layout-3 only); width/padding/margin default to 0. | |
| 9846 | +$css->add_rule( | |
| 9847 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group' ), | |
| 9848 | + $css->properties( | |
| 9849 | + [ | |
| 9850 | + 'border-width' => 'betterdocs_faq_group_border_width_woo' | |
| 9851 | + ], | |
| 9852 | + 'px' | |
| 9853 | + ) | |
| 9854 | +); | |
| 9855 | + | |
| 9856 | +$css->add_rule( | |
| 9857 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group' ), | |
| 9858 | + $css->properties( | |
| 9859 | + [ | |
| 9860 | + 'border-style' => 'solid' | |
| 9861 | + ] | |
| 9862 | + ) | |
| 9863 | +); | |
| 9864 | + | |
| 9865 | +$css->add_rule( | |
| 9866 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group' ), | |
| 9867 | + $css->properties( | |
| 9868 | + [ | |
| 9869 | + 'border-color' => 'betterdocs_faq_group_border_color_woo' | |
| 9870 | + ] | |
| 9871 | + ) | |
| 9872 | +); | |
| 9873 | + | |
| 9874 | +$css->add_rule( | |
| 9875 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group' ), | |
| 9876 | + $css->properties( | |
| 9877 | + [ | |
| 9878 | + 'padding' => 'betterdocs_faq_group_padding_woo' | |
| 9879 | + ], | |
| 9880 | + 'px' | |
| 9881 | + ) | |
| 9882 | +); | |
| 9883 | + | |
| 9884 | +$css->add_rule( | |
| 9885 | + $woo_faq_selector( '.betterdocs-faq-inner-wrapper .betterdocs-faq-list > li .betterdocs-faq-group' ), | |
| 9886 | + $css->properties( | |
| 9887 | + [ | |
| 9888 | + 'margin' => 'betterdocs_faq_group_margin_woo' | |
| 9660 | 9889 | ], |
| 9661 | 9890 | 'px' |
| 9662 | 9891 | ) |
| 9663 | 9892 | ); |