LLMS_Twenty_Twenty_One::generate_inline_styles( string|null $context = null )
Generate inline CSS for a given context
Parameters Parameters
- $context
-
(string|null) (Optional) Inline CSS context. Accepts "editor" to define styles loaded within the block editor or
null
for frontend styles.Default value: null
Return Return
(string)
Source Source
File: includes/theme-support/class-llms-twenty-twenty-one.php
protected static function generate_inline_styles( $context = null ) { $selector_prefix = ( 'editor' === $context ) ? '.editor-styles-wrapper' : ''; $styles = array(); // Frontend only. if ( is_null( $context ) ) { // Fix alignment of content in an access plan. $styles[] = '.llms-access-plan-description ul { padding-left: 0; }'; // Fix checkboxes. $styles[] = '.llms-form-field.type-checkbox input { width: 25px; display: inline-block; }'; // Hide header/footer on certificate pages. $styles[] = '.single-llms_certificate .site-header, .single-llms_my_certificate .site-header, .single-llms_certificate .widget-area, .single-llms_my_certificate .widget-area { display: none; }'; // Question layout. $styles[] = '.llms-question-wrapper ol.llms-question-choices li.llms-choice .llms-choice-text { width: calc( 100% - 110px); }'; // Payment gateway stylized radio buttons. $styles[] = LLMS_Theme_Support::get_css( array( '.llms-form-field.type-radio input[type=radio]:checked+label:before' ), array( 'background-image' => '-webkit-radial-gradient(center,ellipse,var( --global--color-secondary ) 0,var( --global--color-secondary ) 40%,#fafafa 45%)', 'background-image' => 'radial-gradient(ellipse at center,var( --global--color-secondary ) 0,var( --global--color-secondary ) 40%,#fafafa 45%)', ) ); // Darkmode fix. $styles[] = LLMS_Theme_Support::get_css( array( '.is-dark-theme .llms-form-field.type-radio input[type=radio]:checked+label:before' ), array( 'background-image' => array( '-webkit-radial-gradient(center,ellipse,var( --global--color-background ) 0,var( --global--color-background ) 40%,#fafafa 45%)', 'radial-gradient(ellipse at center,var( --global--color-background ) 0,var( --global--color-background ) 40%,#fafafa 45%)', ), ) ); // Donuts. $styles[] = '.llms-donut svg path { stroke: var( --global--color-secondary ); }'; $styles[] = '.is-dark-theme .llms-donut svg path { stroke: var( --global--color-background ); opacity: 0.5; }'; $styles[] = '.is-dark-theme .llms-donut { color: var( --global--color-background ); }'; } // Editor only. if ( 'editor' === $context ) { // Elements with a light background that become unreadable in darkmode in the block editor. $styles[] = LLMS_Theme_Support::get_css( array( '.llms-lesson-link .llms-lesson-title', '.llms-lesson-link .llms-main > *', ), array( 'color' => 'var( --global--color-background )', ), '.is-dark-theme ' . $selector_prefix ); } $styles[] = '.llms-quiz-ui { background: transparent; }'; // Fix anchor buttons. $styles[] = 'a.llms-button-action, a.llms-button-danger, a.llms-button-primary, a.llms-button-secondary { display: inline-block; }'; // Elements with a light background that become unreadable in darkmode. $styles[] = LLMS_Theme_Support::get_css( array( '.is-dark-theme .llms-notification', '.is-dark-theme .llms-table tbody tr:nth-child(odd) td', '.is-dark-theme .llms-table tbody tr:nth-child(odd) td a', '.is-dark-theme .llms-certificate-container', '.is-dark-theme a.llms-certificate', '.is-dark-theme .llms-instructor-info .llms-instructors', '.is-dark-theme .llms-achievement-loop-item.achievement-item', '.is-dark-theme .llms-achievement', '.is-dark-theme .llms-loop-item-content .llms-loop-title:hover', '.llms-notice a', '.is-dark-theme .llms-question-wrapper ol.llms-question-choices li.llms-choice .llms-marker', '.is-dark-theme .llms-table tbody tr:nth-child(odd) td', '.is-dark-theme .llms-table tbody tr:nth-child(odd) th', '.is-dark-theme .llms-lesson-preview.is-complete .llms-lesson-complete', ), array( 'color' => 'var( --global--color-background )', ), $selector_prefix ); $styles[] = LLMS_Theme_Support::get_css( array( '.llms-checkout', '.llms-access-plan .llms-access-plan-footer', '.llms-access-plan .llms-access-plan-content', '.is-dark-theme .llms-progress .progress-bar-complete', ), array( 'background-color' => 'var( --global--color-background )', ), $selector_prefix ); // Add background color and color to qualifying elements. $styles[] = LLMS_Theme_Support::get_css( LLMS_Theme_Support::get_selectors_primary_color_background(), array( 'color' => 'var( --global--color-background )', 'background-color' => 'var( --global--color-secondary )', ), $selector_prefix ); // Add border color to qualifying elements. $styles[] = LLMS_Theme_Support::get_css( LLMS_Theme_Support::get_selectors_primary_color_border(), array( 'border-color' => 'var( --global--color-secondary )', ), $selector_prefix ); // Add color to qualifying elements. $styles[] = LLMS_Theme_Support::get_css( LLMS_Theme_Support::get_selectors_primary_color_text(), array( 'color' => 'var( --global--color-secondary )', ), $selector_prefix ); // Fix progress bars. $styles[] = '.llms-progress { color: var( --global--color-background ); }'; $styles[] = '.is-dark-theme .llms-progress .progress-bar-complete { opacity: 0.5; }'; return implode( "\r", $styles ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.10.0 | Introduced. |