Dashboard
PHP:
8.1.33
OS:
Linux
User:
lawtemple
/
/
home
/
www
/
lawtemplefirm.com
/
wp-content
/
themes
/
law-temple-theme
/
inc
📤 Upload
📝 New File
📁 New Folder
Close
Editing: design-tokens.php
<?php if ( ! defined( 'ABSPATH' ) ) { exit; } function lt_theme_css_variables(){ $o=lt_theme_options(); $vars=array( '--lt-color-primary'=>$o['primary'],'--lt-color-secondary'=>$o['secondary'],'--lt-color-accent'=>$o['accent'],'--lt-color-gold'=>$o['gold'],'--lt-color-heading'=>$o['heading'],'--lt-color-text'=>$o['text'],'--lt-color-muted'=>$o['muted'],'--lt-color-link'=>$o['link'],'--lt-color-link-hover'=>$o['link_hover'],'--lt-color-background'=>$o['background'],'--lt-color-surface'=>$o['alternate'],'--lt-color-dark'=>$o['dark'],'--lt-color-border'=>$o['border'],'--lt-color-button'=>$o['button'],'--lt-color-button-hover'=>$o['button_hover'],'--lt-color-header'=>$o['header'],'--lt-color-header-text'=>$o['header_text'],'--lt-color-footer'=>$o['footer'],'--lt-color-footer-text'=>$o['footer_text'], '--lt-button-primary-bg'=>$o['button_primary_bg'],'--lt-button-primary-text'=>$o['button_primary_text'],'--lt-button-secondary-bg'=>$o['button_secondary_bg'],'--lt-button-secondary-text'=>$o['button_secondary_text'],'--lt-button-gold-bg'=>$o['button_gold_bg'],'--lt-button-gold-text'=>$o['button_gold_text'],'--lt-button-outline'=>$o['button_outline_color'],'--lt-button-dark-bg'=>$o['button_dark_bg'],'--lt-button-dark-text'=>$o['button_dark_text'],'--lt-button-light-bg'=>$o['button_light_bg'],'--lt-button-light-text'=>$o['button_light_text'], '--lt-card-bg'=>$o['card_background'],'--lt-card-border'=>$o['card_border'],'--lt-topbar-bg'=>$o['topbar_background'],'--lt-topbar-text'=>$o['topbar_text_color'],'--lt-announcement-bg'=>$o['announcement_background'],'--lt-announcement-text'=>$o['announcement_text_color'], '--lt-font-body'=>$o['body_font'],'--lt-font-heading'=>$o['heading_font'],'--lt-font-nav'=>$o['nav_font'],'--lt-font-button'=>$o['button_font'],'--lt-font-accent'=>$o['accent_font'], '--lt-body-size'=>$o['body_size'].'px','--lt-body-line'=>$o['body_line'],'--lt-body-letter'=>$o['body_letter'].'px','--lt-body-weight'=>$o['body_weight'],'--lt-h1-size'=>$o['h1_size'].'px','--lt-h2-size'=>$o['h2_size'].'px','--lt-h3-size'=>$o['h3_size'].'px','--lt-h4-size'=>$o['h4_size'].'px','--lt-h5-size'=>$o['h5_size'].'px','--lt-h6-size'=>$o['h6_size'].'px','--lt-heading-weight'=>$o['heading_weight'],'--lt-heading-line'=>$o['heading_line'],'--lt-heading-letter'=>$o['heading_letter'].'px','--lt-heading-transform'=>$o['heading_transform'],'--lt-nav-size'=>$o['nav_size'].'px','--lt-nav-weight'=>$o['nav_weight'],'--lt-nav-letter'=>$o['nav_letter'].'px','--lt-nav-transform'=>$o['nav_transform'],'--lt-button-size'=>$o['button_size'].'px','--lt-button-weight'=>$o['button_weight'],'--lt-button-letter'=>$o['button_letter'].'px','--lt-button-transform'=>$o['button_transform'],'--lt-accent-size'=>$o['accent_size'].'px','--lt-accent-weight'=>$o['accent_weight'],'--lt-accent-letter'=>$o['accent_letter'].'px','--lt-accent-transform'=>$o['accent_transform'],'--lt-tablet-h1'=>$o['tablet_h1'].'px','--lt-tablet-h2'=>$o['tablet_h2'].'px','--lt-tablet-body'=>$o['tablet_body'].'px','--lt-mobile-h1'=>$o['mobile_h1'].'px','--lt-mobile-h2'=>$o['mobile_h2'].'px','--lt-mobile-body'=>$o['mobile_body'].'px', '--lt-site-width'=>$o['site_width'].'px','--lt-content-width'=>$o['content_width'].'px','--lt-wide-width'=>$o['wide_width'].'px','--lt-header-width'=>$o['header_width'].'px','--lt-section-y'=>$o['section_y'].'px','--lt-section-x'=>$o['section_x'].'px','--lt-grid-gap'=>$o['grid_gap'].'px','--lt-card-padding'=>$o['card_padding'].'px','--lt-radius'=>$o['radius'].'px','--lt-border-width'=>$o['border_width'].'px','--lt-button-radius'=>$o['button_radius'].'px','--lt-button-py'=>$o['button_pad_y'].'px','--lt-button-px'=>$o['button_pad_x'].'px','--lt-sidebar-width'=>$o['sidebar_width'].'px','--lt-header-height'=>$o['header_height'].'px','--lt-logo-height'=>($o['logo_height']? $o['logo_height'].'px':'none'),'--lt-logo-spacing'=>$o['logo_spacing'].'px','--lt-logo-width'=>$o['logo_width'].'px','--lt-logo-mobile-width'=>$o['logo_mobile_width'].'px','--lt-hero-height'=>$o['hero_desktop_height'].'px','--lt-hero-tablet-height'=>$o['hero_tablet_height'].'px','--lt-hero-mobile-height'=>$o['hero_mobile_height'].'px','--lt-mobile-hero-media-height'=>$o['mobile_hero_media_height'].'px','--lt-tablet-section-y'=>$o['tablet_section_y'].'px','--lt-mobile-section-y'=>$o['mobile_section_y'].'px','--lt-tablet-grid-gap'=>$o['tablet_grid_gap'].'px','--lt-mobile-grid-gap'=>$o['mobile_grid_gap'].'px','--lt-tablet-gutter'=>$o['tablet_gutter'].'px','--lt-mobile-gutter'=>$o['mobile_gutter'].'px','--lt-mobile-drawer-width'=>$o['mobile_drawer_width'].'vw','--lt-card-ratio'=>$o['card_image_ratio'],'--lt-portrait-ratio'=>$o['portrait_ratio'],'--lt-button-hover-lift'=>$o['button_hover_lift'].'px' ); $css=':root{';foreach($vars as $k=>$v)$css.=$k.':'.$v.';';$css.='}';return $css; } function lt_theme_body_classes($classes){ $classes[]='lt-preset-'.sanitize_html_class(lt_theme_option('preset')); $classes[]='lt-header-'.sanitize_html_class(lt_theme_option('header_layout')); $classes[]='lt-footer-'.sanitize_html_class(lt_theme_option('footer_layout')); $classes[]='lt-card-shadow-'.sanitize_html_class(lt_theme_option('card_shadow')); $classes[]='lt-card-hover-'.sanitize_html_class(lt_theme_option('card_hover')); if(lt_theme_option('sticky_header'))$classes[]='lt-has-sticky-header';if(lt_theme_option('animations'))$classes[]='lt-has-animations';if('boxed'===lt_theme_option('site_layout'))$classes[]='lt-site-boxed';if(lt_theme_option('mega_menu'))$classes[]='lt-mega-menu';if(lt_theme_option('print_styles'))$classes[]='lt-print-enabled';if(!lt_theme_option('card_image_visibility'))$classes[]='lt-hide-card-images';$classes[]='lt-mobile-menu-'.sanitize_html_class(lt_theme_option('mobile_menu_layout'));$classes[]='lt-mobile-hero-media-'.sanitize_html_class(lt_theme_option('mobile_hero_media_position'));$classes[]='lt-mobile-profile-nav-'.sanitize_html_class(lt_theme_option('mobile_profile_nav'));$classes[]='lt-mobile-filters-'.sanitize_html_class(lt_theme_option('mobile_filters_layout'));$classes[]='lt-mobile-footer-'.sanitize_html_class(lt_theme_option('mobile_footer_align'));if(!lt_theme_option('mobile_sticky_header'))$classes[]='lt-mobile-no-sticky';if(!lt_theme_option('mobile_show_topbar'))$classes[]='lt-mobile-hide-topbar';if(!lt_theme_option('mobile_show_announcement'))$classes[]='lt-mobile-hide-announcement';if(lt_theme_option('mobile_show_header_cta'))$classes[]='lt-mobile-show-header-cta';if(lt_theme_option('mobile_hero_hide_media'))$classes[]='lt-mobile-hide-hero-media';if(lt_theme_option('mobile_hero_stack_buttons'))$classes[]='lt-mobile-stack-hero-buttons';if(!lt_theme_option('mobile_breadcrumbs'))$classes[]='lt-mobile-hide-breadcrumbs';return $classes; } add_filter('body_class','lt_theme_body_classes'); /** * Keep WordPress theme.json/editor tokens synchronized with the Theme Options * design system so the Block Editor reflects the live frontend configuration. */ function lt_theme_sync_theme_json( $theme_json ) { if ( ! is_object( $theme_json ) || ! method_exists( $theme_json, 'update_with' ) ) { return $theme_json; } $o = lt_theme_options(); $palette = array( array('slug'=>'primary','name'=>__('Primary','law-temple-theme'),'color'=>$o['primary']), array('slug'=>'secondary','name'=>__('Secondary','law-temple-theme'),'color'=>$o['secondary']), array('slug'=>'accent','name'=>__('Accent','law-temple-theme'),'color'=>$o['accent']), array('slug'=>'gold','name'=>__('Gold / Highlight','law-temple-theme'),'color'=>$o['gold']), array('slug'=>'heading','name'=>__('Heading','law-temple-theme'),'color'=>$o['heading']), array('slug'=>'text','name'=>__('Body Text','law-temple-theme'),'color'=>$o['text']), array('slug'=>'muted','name'=>__('Muted Text','law-temple-theme'),'color'=>$o['muted']), array('slug'=>'background','name'=>__('Background','law-temple-theme'),'color'=>$o['background']), array('slug'=>'surface','name'=>__('Alternate Background','law-temple-theme'),'color'=>$o['alternate']), array('slug'=>'dark','name'=>__('Dark Section','law-temple-theme'),'color'=>$o['dark']), array('slug'=>'border','name'=>__('Border','law-temple-theme'),'color'=>$o['border']), array('slug'=>'white','name'=>__('White','law-temple-theme'),'color'=>'#FFFFFF'), ); $data = array( 'version'=>3, 'settings'=>array( 'layout'=>array('contentSize'=>absint($o['content_width']).'px','wideSize'=>absint($o['wide_width']).'px'), 'color'=>array('palette'=>$palette), 'typography'=>array('fontFamilies'=>array( array('slug'=>'body','name'=>__('Body','law-temple-theme'),'fontFamily'=>$o['body_font']), array('slug'=>'heading','name'=>__('Heading','law-temple-theme'),'fontFamily'=>$o['heading_font']), array('slug'=>'navigation','name'=>__('Navigation','law-temple-theme'),'fontFamily'=>$o['nav_font']), )), ), 'styles'=>array( 'color'=>array('background'=>$o['background'],'text'=>$o['text']), 'typography'=>array('fontFamily'=>'var:preset|font-family|body','fontSize'=>absint($o['body_size']).'px','lineHeight'=>(string)$o['body_line']), 'elements'=>array( 'heading'=>array('color'=>array('text'=>$o['heading']),'typography'=>array('fontFamily'=>'var:preset|font-family|heading','fontWeight'=>(string)$o['heading_weight'],'lineHeight'=>(string)$o['heading_line'])), 'link'=>array('color'=>array('text'=>$o['link'])), 'button'=>array('color'=>array('background'=>$o['button_primary_bg'],'text'=>$o['button_primary_text']),'border'=>array('radius'=>absint($o['button_radius']).'px')), ), ), ); $theme_json->update_with( $data ); return $theme_json; } add_filter( 'wp_theme_json_data_theme', 'lt_theme_sync_theme_json', 20 );
Save
Cancel