Files
2026-04-23 04:33:43 +03:30

289 lines
10 KiB
PHP

<?php
defined( 'ABSPATH' ) || exit;
if( ! function_exists( 'upstudy_get_elementor_container_width' ) ) {
function upstudy_get_elementor_container_width()
{
if (
did_action('elementor/loaded')
&& defined('ELEMENTOR_VERSION')
) {
if (version_compare(ELEMENTOR_VERSION, '3.0', '<')) {
$container_width = get_option('elementor_container_width') ?: 1290;
} else {
$kit_id = (new \Elementor\Core\Kits\Manager())->get_active_id();
$meta_key = \Elementor\Core\Settings\Page\Manager::META_KEY;
$kit_settings = get_post_meta($kit_id, $meta_key, true);
$container_width = $kit_settings['container_width']['size'] ?? 1290;
}
}
return $container_width ?? 1290;
}
}
if( ! function_exists( 'upstudy_theme_base_css' ) ) :
function upstudy_theme_base_css() {
$page_primary_color = get_post_meta(get_the_ID(), '_upstudy_page_primary_color', true);
$the_primary_color = Upstudy::setting( 'primary_color' );
$to_primary_color = ($page_primary_color ) ? $page_primary_color : $the_primary_color;
$default_primary_color = '#1cb098';
$primary_color = (!empty(Upstudy::setting( 'primary_color' ))) ? $to_primary_color : $default_primary_color ;
$page_secondary_color = get_post_meta(get_the_ID(), '_upstudy_page_secondary_color', true);
$the_secondary_color = Upstudy::setting( 'secondary_color' );
$to_secondary_color = ($page_secondary_color ) ? $page_secondary_color : $the_secondary_color;
$default_secondary_color = '#07294d';
$secondary_color = (!empty(Upstudy::setting( 'secondary_color' ))) ? $to_secondary_color : $default_secondary_color ;
$to_tertiary_color = Upstudy::setting( 'tertiary_color' );
$default_tertiary_color = '#021E40';
$heading_color = (!empty(Upstudy::setting( 'tertiary_color' ))) ? $to_tertiary_color : $default_tertiary_color ;
// === Buttons ====
$theme_btn_bg_color = Upstudy::setting( 'btn_color' );
$btn_bg_color = ($theme_btn_bg_color ) ? $theme_btn_bg_color : $primary_color;
$theme_btn_border_color = Upstudy::setting( 'btn_color' );
$btn_border_color = ($theme_btn_border_color ) ? $theme_btn_border_color : $primary_color;
$theme_btn_text_color = Upstudy::setting( 'btn_text_color' );
$btn_text_color = ($theme_btn_text_color ) ? $theme_btn_text_color : '#ffffff';
$theme_btn_hover_color = Upstudy::setting( 'btn_hover_color' );
$btn_bg_hover_color = ($theme_btn_hover_color ) ? $theme_btn_hover_color : $secondary_color;
// === Others ====
$primary_color_alt = Upstudy::setting( 'tpc_primary_color_alter' );
$body_color = Upstudy::setting( 'content_color' ) ?: '#696868';
$page_top_bg_color = get_post_meta(get_the_ID(), '_upstudy_page_top_bg_color', true);
$body_typo_array = Upstudy::setting( 'upstudy_body_text_font' );
$heading_typo_array = Upstudy::setting( 'upstudy_heading_font' );
$body_font_family = 'Outfit';
$heading_font_family = 'Outfit';
$body_font_size = '16px';
if ( isset( $body_typo_array['font-family'] ) && ! empty( $body_typo_array['font-family'] ) ) :
$body_font_family = $body_typo_array['font-family'];
endif;
if ( isset( $body_typo_array['font-size'] ) && ! empty( $body_typo_array['font-size'] ) ) :
$body_font_size = '16px';
endif;
if ( isset( $heading_typo_array['font-family'] ) && ! empty( $heading_typo_array['font-family'] ) ) :
$heading_font_family = $heading_typo_array['font-family'];
endif;
$upstudy_elementor_container_width = upstudy_get_elementor_container_width() . 'px;';
$base_css = ":root {
--upstudy-elementor-container-width: {$upstudy_elementor_container_width};
--upstudy-primary-color: {$primary_color};
--upstudy-primary-color-alt: {$primary_color_alt};
--upstudy-color-secondary: {$secondary_color};
--upstudy-color-thirty: #021E40;
--upstudy-color-01: #ff4830;
--upstudy-color-02: #6cbd7f;
--upstudy-color-03: #8e56ff;
--upstudy-color-04: #17b8c1;
--upstudy-color-05: #3BBC9B;
--upstudy-color-06: #0071dc;
--upstudy-heading-color: {$heading_color};
--upstudy-color-body: {$body_color};
--upstudy-color-meta: #9a9a9a;
--upstudy-color-meta-02: #6b6b6b;
--upstudy-color-btn-bg: {$btn_bg_color};
--upstudy-color-btn-border: {$btn_border_color};
--upstudy-color-btn-text: {$btn_text_color};
--upstudy-color-btn-bg-hover: {$secondary_color};
--upstudy-color-btn-border-hover: {$secondary_color};
--upstudy-color-btn-text-hover: #ffffff;
--upstudy-color-placeholder: #CCCCCC;
--upstudy-shadow-01: 0 0 30px rgb(0 0 0 / 5%);
--upstudy-color-tertiary: #f8b81f;
--upstudy-color-dark: #231F40;
--upstudy-color-white: #ffffff;
--upstudy-color-shade: #F5F5F5;
--upstudy-color-border: #ebebeb;
--upstudy-color-border-02: #eeeeee;
--upstudy-color-black: #000000;
--upstudy-p-regular: 400;
--upstudy-p-medium: 500;
--upstudy-p-semi-bold: 600;
--upstudy-p-bold: 700;
--upstudy-p-extra-bold: 800;
--upstudy-p-black: 900;
--upstudy-box-shadow: 0 6px 12px rgb(0 0 0 / 6%);
--upstudy-transition: 0.3s;
--upstudy-font-primary: '{$body_font_family}', sans-serif;
--upstudy-font-secondary: '{$heading_font_family}', sans-serif;
--upstudy-font-size-b1: {$body_font_size};
--upstudy-font-size-b2: 13px;
--upstudy-font-size-b3: 14px;
--upstudy-font-size-b4: 12px;
--upstudy-line-height-b1: 1.73;
--upstudy-h1: 52px;
--upstudy-h2: 38px;
--upstudy-h3: 32px;
--upstudy-h4: 22px;
--upstudy-h5: 18px;
--upstudy-h6: 16px;
--upstudy-h1-lineHeight: 1.2;
--upstudy-h2-lineHeight: 1.39;
--upstudy-h3-lineHeight: 1.43;
--upstudy-h4-lineHeight: 1.4;
--upstudy-h5-lineHeight: 1.45;
--upstudy-h6-lineHeight: 1.62;
}";
// === Button style ===
$upstudy_button_style = Upstudy::setting( 'upstudy_button_style' );
if ( '2' === $upstudy_button_style ) :
$base_css .= "
body #learn-press-profile-basic-information button[type=submit], body .profile-basic-information button, body form[name=profile-change-password] button, body #popup-content .lp-button, body.learnpress-page .lp-button, body.learnpress-page #lp-button, body #checkout-payment #checkout-order-action button, .woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button, body .learndash-wrapper .ld-expand-button, .edu-btn, a.edu-btn {
border-radius:5px !important;
}
";
endif;
// === Page Header Top Background Color ===
if ( !empty($page_top_bg_color) ) :
$base_css .= "
body .tpc-header-top-bar, body .tpc-header-top-bar.tpc-top-bar-style-2 {
background: {$page_top_bg_color};
}
";
endif;
// === Page Header Top Background Color ===
if ( !Upstudy::setting( 'email_small_device' ) || !Upstudy::setting( 'phone_small_device' ) || !Upstudy::setting( 'message_small_device' ) || !Upstudy::setting( 'login_reg_small_device' ) || !Upstudy::setting( 'profile_small_device' ) ) :
$base_css .= "
@media only screen and (max-width: 991px) {";
if (!Upstudy::setting( 'phone_small_device' )) {
$base_css .= "
.header-top-phone {
display: none;
}
";
}
if (!Upstudy::setting( 'email_small_device' )) {
$base_css .= "
.header-top-email {
display: none;
}
";
}
if (!Upstudy::setting( 'message_small_device' )) {
$base_css .= "
.header-top-message {
display: none;
}
";
}
if (!Upstudy::setting( 'login_reg_small_device' )) {
$base_css .= "
.header-top-login-register {
display: none;
}
";
}
if (!Upstudy::setting( 'profile_small_device' )) {
$base_css .= "
.header-top-profile{
display: none;
}
";
}
$base_css .= "}";
endif;
// === Responsive ===
$mobile_logo_size = Upstudy::setting( 'mobile_logo_size' );
$mobile_logo_screen_width = Upstudy::setting( 'mobile_logo_screen_width' );
if ( $mobile_logo_size !== 180 ) :
$base_css .= "
@media only screen and (max-width: {$mobile_logo_screen_width}px) {";
$base_css .= "
body .site-branding img.site-logo {
max-width: {$mobile_logo_size}px;
}
";
$base_css .= "}";
endif;
// === Page Top Bottom Space On/Off ===
// if ( '1' === Upstudy::setting( 'top_bottom_space_show' ) ) :
// $base_css .= "
// body.elementor-page:not(.upstudy-page-breadcrumb-disable) .tpc-site-content {
// padding: 90px 0;
// }
// ";
// endif;
// === Pagination style ===
if ( '2' === Upstudy::setting( 'pagination_style' ) ) :
$base_css .= "
body .tutor-pagination-wrap span, body .tutor-pagination-wrap a, nav.upstudy-theme-page-links ul.pager li span, nav.upstudy-theme-page-links ul.pager li a, .upstudy-pagination-wrapper.woocommerce-pagination .page-numbers .page-numbers, .upstudy-pagination-wrapper .page-number .page-numbers {
border-radius:50%;
}
body .tutor-pagination-wrap span:before, body .tutor-pagination-wrap a:before, nav.upstudy-theme-page-links ul.pager li span:before, nav.upstudy-theme-page-links ul.pager li a:before, .upstudy-pagination-wrapper.woocommerce-pagination .page-numbers .page-numbers:before, .upstudy-pagination-wrapper .page-number .page-numbers:before{
border-radius:50%;
}
";
endif;
// === Sensei LMS style ===
if ( Upstudy::setting( 'sensei_layout_override' ) ) :
$base_css .= "
.wp-block-sensei-lms-course-outline-lesson:not(.has-text-color), .entry-content .wp-block-sensei-lms-course-outline-lesson:not(.has-text-color), .sensei .entry-content .wp-block-sensei-lms-course-outline-lesson:not(.button):not(.has-text-color) {
border-radius:5px;
}
.wp-block-sensei-lms-course-outline-lesson>span {
padding: 15px 16px;
}
";
endif;
$base_css = apply_filters( 'upstudy_custom_color_style_css', $base_css );
return $base_css;
}
endif;
if( ! function_exists( 'upstudy_custom_color_styles' ) ) :
function upstudy_custom_color_styles() {
wp_add_inline_style( 'upstudy-main', html_entity_decode( upstudy_theme_base_css(), ENT_QUOTES ) );
}
endif;
add_action( 'wp_enqueue_scripts', 'upstudy_custom_color_styles', 20);