2025-07-27 19:55:19 +02:00
/ * *
* This file adds some LIVE to the Theme Customizer live preview . To leverage
* this , set your custom settings to 'postMessage' and then add your handling
* here . Your javascript should grab settings from customizer controls , and
* then make any necessary changes to the page using jQuery .
*
* @ package Astra
* /
/ * *
* Generate font size in PX & REM
* /
function astra _font _size _rem ( size , with _rem , device ) {
var css = '' ;
if ( size != '' ) {
var device = ( typeof device !== 'undefined' ) ? device : 'desktop' ;
// font size with 'px'.
css = 'font-size: ' + size + 'px;' ;
// font size with 'rem'.
if ( with _rem ) {
var body _font _size = wp . customize ( 'astra-settings[font-size-body]' ) . get ( ) ;
body _font _size [ 'desktop' ] = ( body _font _size [ 'desktop' ] != '' ) ? body _font _size [ 'desktop' ] : 15 ;
body _font _size [ 'tablet' ] = ( body _font _size [ 'tablet' ] != '' ) ? body _font _size [ 'tablet' ] : body _font _size [ 'desktop' ] ;
body _font _size [ 'mobile' ] = ( body _font _size [ 'mobile' ] != '' ) ? body _font _size [ 'mobile' ] : body _font _size [ 'tablet' ] ;
if ( body _font _size [ device + '-unit' ] === 'px' ) {
css += 'font-size: ' + ( size / body _font _size [ device ] ) + 'rem;' ;
}
}
}
return css ;
}
/ * *
* Refresh customizer iframe .
* /
function astra _refresh _customizer ( control ) {
wp . customize ( control , function ( value ) {
value . bind ( function ( value ) {
wp . customize . preview . send ( 'refresh' ) ;
} ) ;
} ) ;
}
/ * *
* Apply CSS for the element
* /
function astra _color _responsive _css ( addon , control , css _property , selector ) {
wp . customize ( control , function ( value ) {
value . bind ( function ( value ) {
if ( value . desktop || value . mobile || value . tablet ) {
// Remove <style> first!
control = control . replace ( '[' , '-' ) ;
control = control . replace ( ']' , '' ) ;
jQuery ( 'style#' + control + '-' + addon ) . remove ( ) ;
var DeskVal = '' ,
TabletFontVal = '' ,
MobileVal = '' ;
if ( '' != value . desktop ) {
DeskVal = css _property + ': ' + value . desktop ;
}
if ( '' != value . tablet ) {
TabletFontVal = css _property + ': ' + value . tablet ;
}
if ( '' != value . mobile ) {
MobileVal = css _property + ': ' + value . mobile ;
}
// Concat and append new <style>.
jQuery ( 'head' ) . append (
'<style id="' + control + '-' + addon + '">'
+ selector + ' { ' + DeskVal + ' }'
+ '@media (max-width: 768px) {' + selector + ' { ' + TabletFontVal + ' } }'
+ '@media (max-width: 544px) {' + selector + ' { ' + MobileVal + ' } }'
+ '</style>'
) ;
} else {
jQuery ( 'style#' + control + '-' + addon ) . remove ( ) ;
}
} ) ;
} ) ;
}
/ * *
* Responsive Font Size CSS
* /
function astra _responsive _font _size ( control , selector , dispatchCustomEvent = false , styleGuideSelector = '' ) {
wp . customize ( control , function ( value ) {
value . bind ( function ( value ) {
if ( value . desktop || value . mobile || value . tablet ) {
// Remove <style> first!
control = control . replace ( '[' , '-' ) ;
control = control . replace ( ']' , '' ) ;
var css _property = 'font-size' ,
fontSize = value [ 'desktop-unit' ] == 'px' ? astra _font _size _rem ( value . desktop , true , 'desktop' ) : '' ,
tabletFontSize = '' ,
mobileFontSize = '' ;
jQuery ( 'style#' + control + '-' + css _property ) . remove ( ) ;
if ( '' != value . desktop ) {
fontSize = fontSize || 'font-size: ' + value . desktop + ( undefined == value [ 'desktop-unit' ] ? 'px' : value [ 'desktop-unit' ] ) ;
}
if ( '' != value . tablet ) {
tabletFontSize = 'font-size: ' + value . tablet + ( undefined == value [ 'tablet-unit' ] ? 'px' : value [ 'tablet-unit' ] ) ;
}
if ( '' != value . mobile ) {
mobileFontSize = 'font-size: ' + value . mobile + ( undefined == value [ 'mobile-unit' ] ? 'px' : value [ 'mobile-unit' ] ) ;
}
// Concat and append new <style>.
jQuery ( 'head' ) . append (
'<style id="' + control + '-' + css _property + '">'
+ selector + ' { ' + fontSize + ' }'
+ '@media (max-width: 768px) {' + selector + ' { ' + tabletFontSize + ' } }'
+ '@media (max-width: 544px) {' + selector + ' { ' + mobileFontSize + ' } }'
+ '</style>'
) ;
if ( dispatchCustomEvent ) {
let styleGuideUpdatedEvent = new CustomEvent ( 'AstraStyleGuideElementUpdated' , {
'detail' : {
'value' : {
'desktop' : value . desktop + ( undefined == value [ 'desktop-unit' ] ? 'px' : value [ 'desktop-unit' ] ) ,
'tablet' : value . tablet + ( undefined == value [ 'tablet-unit' ] ? 'px' : value [ 'tablet-unit' ] ) ,
'mobile' : value . mobile + ( undefined == value [ 'mobile-unit' ] ? 'px' : value [ 'mobile-unit' ] )
} ,
'selector' : styleGuideSelector
}
} ) ;
document . dispatchEvent ( styleGuideUpdatedEvent ) ;
}
} else {
jQuery ( 'style#' + control + '-font-size' ) . remove ( ) ;
}
} ) ;
} ) ;
}
/ * *
* Font extras control dynamic CSS .
*
* @ since x . x . x
* /
function astra _font _extras _css ( control , selector ) {
wp . customize ( 'astra-settings[' + control + ']' , function ( value ) {
value . bind ( function ( data ) {
if ( data ) {
// Remove <style> first!
jQuery ( 'style#' + control ) . remove ( ) ;
let dynamicStyle = selector + ' { line-height : ' + data [ 'line-height' ] + data [ 'line-height-unit' ] + ";" ;
dynamicStyle += 'letter-spacing : ' + data [ 'letter-spacing' ] + data [ 'letter-spacing-unit' ] + ";" ;
dynamicStyle += 'text-decoration : ' + data [ 'text-decoration' ] + ";" ;
dynamicStyle += 'text-transform : ' + data [ 'text-transform' ] + ';}' ;
// Concat and append new <style>.
jQuery ( 'head' ) . append (
'<style id="' + control + '">'
+ dynamicStyle + '</style>'
) ;
} else {
jQuery ( 'style#' + control ) . remove ( ) ;
}
} ) ;
} ) ;
}
/ * *
* Responsive Spacing CSS
* /
function astra _responsive _spacing ( control , selector , type , side ) {
wp . customize ( control , function ( value ) {
value . bind ( function ( value ) {
var sidesString = "" ;
var spacingType = "padding" ;
if ( value . desktop . top || value . desktop . right || value . desktop . bottom || value . desktop . left || value . tablet . top || value . tablet . right || value . tablet . bottom || value . tablet . left || value . mobile . top || value . mobile . right || value . mobile . bottom || value . mobile . left ) {
if ( typeof side !== 'undefined' ) {
sidesString = side + "" ;
// Replace comma character with dash, necessary to separate out spacing dimensions.
sidesString = sidesString . replace ( /,/g , "-" ) ;
}
if ( typeof type !== 'undefined' ) {
spacingType = type + "" ;
}
// Remove <style> first!
control = control . replace ( '[' , '-' ) ;
control = control . replace ( ']' , '' ) ;
jQuery ( 'style#' + control + '-' + spacingType + '-' + sidesString ) . remove ( ) ;
var desktopPadding = '' ,
tabletPadding = '' ,
mobilePadding = '' ;
var paddingSide = ( typeof side !== 'undefined' ) ? side : [ 'top' , 'bottom' , 'right' , 'left' ] ;
jQuery . each ( paddingSide , function ( index , sideValue ) {
if ( '' != value [ 'desktop' ] [ sideValue ] ) {
desktopPadding += spacingType + '-' + sideValue + ': ' + value [ 'desktop' ] [ sideValue ] + value [ 'desktop-unit' ] + ';' ;
}
} ) ;
jQuery . each ( paddingSide , function ( index , sideValue ) {
if ( '' != value [ 'tablet' ] [ sideValue ] ) {
tabletPadding += spacingType + '-' + sideValue + ': ' + value [ 'tablet' ] [ sideValue ] + value [ 'tablet-unit' ] + ';' ;
}
} ) ;
jQuery . each ( paddingSide , function ( index , sideValue ) {
if ( '' != value [ 'mobile' ] [ sideValue ] ) {
mobilePadding += spacingType + '-' + sideValue + ': ' + value [ 'mobile' ] [ sideValue ] + value [ 'mobile-unit' ] + ';' ;
}
} ) ;
// Concat and append new <style>.
jQuery ( 'head' ) . append (
'<style id="' + control + '-' + spacingType + '-' + sidesString + '">'
+ selector + ' { ' + desktopPadding + ' }'
+ '@media (max-width: 768px) {' + selector + ' { ' + tabletPadding + ' } }'
+ '@media (max-width: 544px) {' + selector + ' { ' + mobilePadding + ' } }'
+ '</style>'
) ;
} else {
wp . customize . preview . send ( 'refresh' ) ;
jQuery ( 'style#' + control + '-' + spacingType + '-' + sidesString ) . remove ( ) ;
}
} ) ;
} ) ;
}
/ * *
* CSS
* /
function astra _css _font _size ( control , selector ) {
wp . customize ( control , function ( value ) {
value . bind ( function ( size ) {
if ( size ) {
// Remove <style> first!
control = control . replace ( '[' , '-' ) ;
control = control . replace ( ']' , '' ) ;
jQuery ( 'style#' + control ) . remove ( ) ;
var fontSize = 'font-size: ' + size ;
if ( ! Number . isNaN ( size ) || size . indexOf ( 'px' ) >= 0 ) {
size = size . replace ( 'px' , '' ) ;
fontSize = astra _font _size _rem ( size , true ) ;
}
// Concat and append new <style>.
jQuery ( 'head' ) . append (
'<style id="' + control + '">'
+ selector + ' { ' + fontSize + ' }'
+ '</style>'
) ;
} else {
jQuery ( 'style#' + control ) . remove ( ) ;
}
} ) ;
} ) ;
}
/ * *
* Return get _hexdec ( )
* /
function get _hexdec ( hex ) {
var hexString = hex . toString ( 16 ) ;
return parseInt ( hexString , 16 ) ;
}
/ * *
* Apply CSS for the element
* /
2026-03-31 11:30:59 +02:00
function astra _css ( control , css _property , selector , unit , important = false , additionalCss = '' ) {
2025-07-27 19:55:19 +02:00
wp . customize ( control , function ( value ) {
value . bind ( function ( new _value ) {
// Remove <style> first!
control = control . replace ( '[' , '-' ) ;
control = control . replace ( ']' , '' ) ;
if ( new _value || 0 === new _value ) {
/ * *
* If ( unit == 'url' ) then = url ( '{VALUE}' )
* If ( unit == 'px' ) then = { VALUE } px
* If ( unit == 'em' ) then = { VALUE } em
* If ( unit == 'rem' ) then = { VALUE } rem .
* /
if ( 'undefined' != typeof unit ) {
if ( 'url' === unit ) {
new _value = 'url(' + new _value + ')' ;
} else {
new _value = new _value + unit ;
}
}
const imp _css _prop = important ? ' !important' : '' ;
// Remove old.
jQuery ( 'style#' + control + '-' + css _property ) . remove ( ) ;
// Concat and append new <style>.
jQuery ( 'head' ) . append (
'<style id="' + control + '-' + css _property + '">'
2026-03-31 11:30:59 +02:00
+ selector + ' { ' + css _property + ': ' + new _value + imp _css _prop + ';' + additionalCss + ' }'
2025-07-27 19:55:19 +02:00
+ '</style>'
) ;
if ( 'unset' === new _value ) {
jQuery ( 'style#' + control + '-' + css _property ) . remove ( ) ;
}
} else {
// Remove old.
jQuery ( 'style#' + control + '-' + css _property ) . remove ( ) ;
}
} ) ;
} ) ;
}
/ * *
* Dynamic Internal / Embedded Style for a Control
* /
function astra _add _dynamic _css ( control , style ) {
control = control . replace ( '[' , '-' ) ;
control = control . replace ( ']' , '' ) ;
jQuery ( 'style#' + control ) . remove ( ) ;
jQuery ( 'head' ) . append (
'<style id="' + control + '">' + style + '</style>'
) ;
}
/ * *
* Generate background _obj CSS
* /
function astra _background _obj _css ( wp _customize , bg _obj , ctrl _name , style ) {
var gen _bg _css = '' ;
var bg _img = bg _obj [ 'background-image' ] ;
var bg _color = bg _obj [ 'background-color' ] ;
if ( '' === bg _color && '' === bg _img ) {
jQuery ( 'style#' + ctrl _name ) . remove ( ) ;
} else {
if ( undefined !== bg _obj [ 'background-type' ] && '' !== bg _obj [ 'background-type' ] ) {
if ( ( 'color' === bg _obj [ 'background-type' ] ) ) {
if ( '' !== bg _img && '' !== bg _color && undefined !== bg _color && 'unset' !== bg _color ) {
gen _bg _css = 'background-image: linear-gradient(to right, ' + bg _color + ', ' + bg _color + '), url(' + bg _img + ');' ;
} else if ( undefined === bg _img || '' === bg _img || 'unset' === bg _img ) {
gen _bg _css = 'background-color: ' + bg _color + ';' ;
}
} else if ( 'image' === bg _obj [ 'background-type' ] ) {
if ( '' !== bg _img ) {
if ( 'overlay-type' in bg _obj && 'none' !== bg _obj [ 'overlay-type' ] ) {
let overlay _color = 'overlay-color' in bg _obj ? bg _obj [ 'overlay-color' ] : '' ;
let overlay _opacity = 'overlay-opacity' in bg _obj ? bg _obj [ 'overlay-opacity' ] : '' ;
let overlay _gradient = 'overlay-gradient' in bg _obj ? bg _obj [ 'overlay-gradient' ] : '' ;
if ( 'classic' === bg _obj [ 'overlay-type' ] && '' !== overlay _color ) {
if ( '' !== overlay _opacity ) {
wp . customize . preview . send ( 'refresh' ) ;
return ;
}
gen _bg _css = 'background-image: linear-gradient(to right, ' + bg _obj [ 'overlay-color' ] + ', ' + bg _obj [ 'overlay-color' ] + '), url(' + bg _img + ');' ;
} else if ( 'gradient' === bg _obj [ 'overlay-type' ] && '' !== overlay _gradient ) {
gen _bg _css = 'background-image: ' + overlay _gradient + ', url(' + bg _img + ');' ;
} else {
gen _bg _css = 'background-image: url(' + bg _img + ');' ;
}
} else {
gen _bg _css = 'background-image: url(' + bg _img + ');' ;
}
}
} else if ( 'gradient' === bg _obj [ 'background-type' ] ) {
if ( '' !== bg _color && 'unset' !== bg _color ) {
gen _bg _css = 'background-image: ' + bg _color + ';' ;
}
}
}
if ( '' !== bg _img ) {
gen _bg _css += 'background-repeat: ' + bg _obj [ 'background-repeat' ] + ';' ;
gen _bg _css += 'background-position: ' + bg _obj [ 'background-position' ] + ';' ;
gen _bg _css += 'background-size: ' + bg _obj [ 'background-size' ] + ';' ;
gen _bg _css += 'background-attachment: ' + bg _obj [ 'background-attachment' ] + ';' ;
}
var dynamicStyle = style . replace ( "{{css}}" , gen _bg _css ) ;
astra _add _dynamic _css ( ctrl _name , dynamicStyle ) ;
}
}
/ *
* Generate Font Family CSS
* /
function astra _generate _outside _font _family _css ( control , selector , dispatchCustomEvent = false , styleGuideSelector = '' ) {
wp . customize ( control , function ( value ) {
value . bind ( function ( value , oldValue ) {
var cssProperty = 'font-family' ;
var link = '' ;
var fontName = value . split ( "," ) [ 0 ] ;
// Replace ' character with space, necessary to separate out font prop value.
fontName = fontName . replace ( /'/g , '' ) ;
// Remove <style> first!
control = control . replace ( '[' , '-' ) ;
control = control . replace ( ']' , '' ) ;
jQuery ( 'style#' + control + '-' + cssProperty ) . remove ( ) ;
if ( fontName in astraCustomizer . googleFonts ) {
// Remove old.
var fontName = fontName . split ( ' ' ) . join ( '+' ) ;
jQuery ( 'link#' + control ) . remove ( ) ;
link = '<link id="' + control + '" href="https://fonts.googleapis.com/css?family=' + fontName + '" rel="stylesheet">' ;
}
if ( dispatchCustomEvent ) {
let styleGuideUpdatedEvent = new CustomEvent ( 'AstraStyleGuideElementUpdated' , {
'detail' : {
'value' : value ,
'selector' : styleGuideSelector
}
} ) ;
document . dispatchEvent ( styleGuideUpdatedEvent ) ;
}
// Concat and append new <style> and <link>.
jQuery ( 'head' ) . append (
'<style id="' + control + '-' + cssProperty + '">'
+ selector + ' { ' + cssProperty + ': ' + value + ' }'
+ '</style>'
+ link
) ;
} ) ;
} ) ;
}
/ * *
* Apply Advanced CSS for the element
*
* @ param string section Section ID .
* @ param string selector Base Selector .
* /
function astra _builder _advanced _css ( section , selector ) {
var tablet _break _point = 921 ,
mobile _break _point = 544 ;
// Padding.
wp . customize ( 'astra-settings[' + section + '-padding]' , function ( value ) {
value . bind ( function ( padding ) {
if ( ! padding . hasOwnProperty ( 'desktop' ) ) {
return
}
if (
padding . desktop . bottom != '' || padding . desktop . top != '' || padding . desktop . left != '' || padding . desktop . right != '' ||
padding . tablet . bottom != '' || padding . tablet . top != '' || padding . tablet . left != '' || padding . tablet . right != '' ||
padding . mobile . bottom != '' || padding . mobile . top != '' || padding . mobile . left != '' || padding . mobile . right != ''
) {
var dynamicStyle = '' ;
dynamicStyle += selector + ' {' ;
dynamicStyle += 'padding-left: ' + padding [ 'desktop' ] [ 'left' ] + padding [ 'desktop-unit' ] + ';' ;
dynamicStyle += 'padding-right: ' + padding [ 'desktop' ] [ 'right' ] + padding [ 'desktop-unit' ] + ';' ;
dynamicStyle += 'padding-top: ' + padding [ 'desktop' ] [ 'top' ] + padding [ 'desktop-unit' ] + ';' ;
dynamicStyle += 'padding-bottom: ' + padding [ 'desktop' ] [ 'bottom' ] + padding [ 'desktop-unit' ] + ';' ;
dynamicStyle += '} ' ;
dynamicStyle += '@media (max-width: ' + tablet _break _point + 'px) {' ;
dynamicStyle += selector + ' {' ;
dynamicStyle += 'padding-left: ' + padding [ 'tablet' ] [ 'left' ] + padding [ 'tablet-unit' ] + ';' ;
dynamicStyle += 'padding-right: ' + padding [ 'tablet' ] [ 'right' ] + padding [ 'tablet-unit' ] + ';' ;
dynamicStyle += 'padding-top: ' + padding [ 'tablet' ] [ 'top' ] + padding [ 'tablet-unit' ] + ';' ;
dynamicStyle += 'padding-bottom: ' + padding [ 'tablet' ] [ 'bottom' ] + padding [ 'tablet-unit' ] + ';' ;
dynamicStyle += '} ' ;
dynamicStyle += '} ' ;
dynamicStyle += '@media (max-width: ' + mobile _break _point + 'px) {' ;
dynamicStyle += selector + ' {' ;
dynamicStyle += 'padding-left: ' + padding [ 'mobile' ] [ 'left' ] + padding [ 'mobile-unit' ] + ';' ;
dynamicStyle += 'padding-right: ' + padding [ 'mobile' ] [ 'right' ] + padding [ 'mobile-unit' ] + ';' ;
dynamicStyle += 'padding-top: ' + padding [ 'mobile' ] [ 'top' ] + padding [ 'mobile-unit' ] + ';' ;
dynamicStyle += 'padding-bottom: ' + padding [ 'mobile' ] [ 'bottom' ] + padding [ 'mobile-unit' ] + ';' ;
dynamicStyle += '} ' ;
dynamicStyle += '} ' ;
astra _add _dynamic _css ( section + '-padding-toggle-button' , dynamicStyle ) ;
} else {
astra _add _dynamic _css ( section + '-padding-toggle-button' , '' ) ;
}
} ) ;
} ) ;
// Margin.
wp . customize ( 'astra-settings[' + section + '-margin]' , function ( value ) {
value . bind ( function ( margin ) {
if ( ! margin . hasOwnProperty ( 'desktop' ) ) {
return
}
if (
margin . desktop . bottom != '' || margin . desktop . top != '' || margin . desktop . left != '' || margin . desktop . right != '' ||
margin . tablet . bottom != '' || margin . tablet . top != '' || margin . tablet . left != '' || margin . tablet . right != '' ||
margin . mobile . bottom != '' || margin . mobile . top != '' || margin . mobile . left != '' || margin . mobile . right != ''
) {
var dynamicStyle = '' ;
dynamicStyle += selector + ' {' ;
dynamicStyle += 'margin-left: ' + margin [ 'desktop' ] [ 'left' ] + margin [ 'desktop-unit' ] + ';' ;
dynamicStyle += 'margin-right: ' + margin [ 'desktop' ] [ 'right' ] + margin [ 'desktop-unit' ] + ';' ;
dynamicStyle += 'margin-top: ' + margin [ 'desktop' ] [ 'top' ] + margin [ 'desktop-unit' ] + ';' ;
dynamicStyle += 'margin-bottom: ' + margin [ 'desktop' ] [ 'bottom' ] + margin [ 'desktop-unit' ] + ';' ;
dynamicStyle += '} ' ;
dynamicStyle += '@media (max-width: ' + tablet _break _point + 'px) {' ;
dynamicStyle += selector + ' {' ;
dynamicStyle += 'margin-left: ' + margin [ 'tablet' ] [ 'left' ] + margin [ 'tablet-unit' ] + ';' ;
dynamicStyle += 'margin-right: ' + margin [ 'tablet' ] [ 'right' ] + margin [ 'tablet-unit' ] + ';' ;
dynamicStyle += 'margin-top: ' + margin [ 'tablet' ] [ 'top' ] + margin [ 'tablet-unit' ] + ';' ;
dynamicStyle += 'margin-bottom: ' + margin [ 'tablet' ] [ 'bottom' ] + margin [ 'tablet-unit' ] + ';' ;
dynamicStyle += '} ' ;
dynamicStyle += '} ' ;
dynamicStyle += '@media (max-width: ' + mobile _break _point + 'px) {' ;
dynamicStyle += selector + ' {' ;
dynamicStyle += 'margin-left: ' + margin [ 'mobile' ] [ 'left' ] + margin [ 'mobile-unit' ] + ';' ;
dynamicStyle += 'margin-right: ' + margin [ 'mobile' ] [ 'right' ] + margin [ 'mobile-unit' ] + ';' ;
dynamicStyle += 'margin-top: ' + margin [ 'mobile' ] [ 'top' ] + margin [ 'mobile-unit' ] + ';' ;
dynamicStyle += 'margin-bottom: ' + margin [ 'mobile' ] [ 'bottom' ] + margin [ 'mobile-unit' ] + ';' ;
dynamicStyle += '} ' ;
dynamicStyle += '} ' ;
astra _add _dynamic _css ( section + '-margin-toggle-button' , dynamicStyle ) ;
} else {
astra _add _dynamic _css ( section + '-margin-toggle-button' , '' ) ;
}
} ) ;
} ) ;
}
/ * *
* Apply Advanced CSS for the element
*
* @ param string section Section ID .
* @ param string selector Base Selector .
* /
function astra _border _spacing _advanced _css ( section , selector ) {
wp . customize ( 'astra-settings[' + section + '-border-width]' , function ( setting ) {
setting . bind ( function ( border ) {
var dynamicStyle = selector + ' {' ;
if ( border . top ) {
dynamicStyle += 'border-top-style: solid;' ;
dynamicStyle += 'border-top-width: ' + border . top + 'px;' ;
}
if ( border . right ) {
dynamicStyle += 'border-right-style: solid;' ;
dynamicStyle += 'border-right-width: ' + border . right + 'px;' ;
}
if ( border . bottom ) {
dynamicStyle += 'border-bottom-style: solid;' ;
dynamicStyle += 'border-bottom-width: ' + border . bottom + 'px;' ;
}
if ( border . left ) {
dynamicStyle += 'border-left-style: solid;' ;
dynamicStyle += 'border-left-width: ' + border . left + 'px;' ;
}
dynamicStyle += '} ' ;
astra _add _dynamic _css ( 'astra-settings[' + section + '-border-width]' , dynamicStyle ) ;
} ) ;
} ) ;
wp . customize ( 'astra-settings[' + section + '-border-radius]' , function ( setting ) {
setting . bind ( function ( border ) {
if ( ! border . top && ! border . right && ! border . bottom && ! border . left ) {
wp . customize . preview . send ( 'refresh' ) ;
return ;
}
var dynamicStyle = selector + ' {' ;
if ( border . top !== '' ) {
dynamicStyle += 'border-top-left-radius: ' + border . top + 'px;' ;
}
if ( border . right !== '' ) {
dynamicStyle += 'border-top-right-radius: ' + border . right + 'px;' ;
}
if ( border . left !== '' ) {
dynamicStyle += 'border-bottom-left-radius: ' + border . left + 'px;' ;
}
if ( border . bottom !== '' ) {
dynamicStyle += 'border-bottom-right-radius: ' + border . bottom + 'px;' ;
}
dynamicStyle += '} ' ;
astra _add _dynamic _css ( 'astra-settings[' + section + '-border-radius]' , dynamicStyle ) ;
} ) ;
} ) ;
astra _css ( 'astra-settings[' + section + '-border-color]' , 'border-color' , selector ) ;
astra _builder _advanced _css ( section , selector ) ;
}
/ *
* Generate Font Weight CSS
* /
function astra _generate _font _weight _css ( font _control , control , css _property , selector ) {
wp . customize ( control , function ( value ) {
value . bind ( function ( new _value ) {
control = control . replace ( '[' , '-' ) ;
control = control . replace ( ']' , '' ) ;
var link = '' ;
if ( new _value ) {
/ * *
* If ( unit == 'url' ) then = url ( '{VALUE}' )
* If ( unit == 'px' ) then = { VALUE } px
* If ( unit == 'em' ) then = { VALUE } em
* If ( unit == 'rem' ) then = { VALUE } rem .
* /
if ( 'undefined' != typeof unit ) {
if ( 'url' === unit ) {
new _value = 'url(' + new _value + ')' ;
} else {
new _value = new _value + unit ;
}
}
var fontName = wp . customize . _value [ font _control ] . _value ;
fontName = fontName . split ( ',' ) ;
fontName = fontName [ 0 ] . replace ( /'/g , '' ) ;
// Remove old.
jQuery ( 'style#' + control + '-' + css _property ) . remove ( ) ;
if ( fontName in astraCustomizer . googleFonts ) {
// Remove old.
jQuery ( '#' + font _control ) . remove ( ) ;
if ( new _value === "inherit" ) {
link = '<link id="' + font _control + '" href="https://fonts.googleapis.com/css?family=' + fontName + '" rel="stylesheet">' ;
} else {
link = '<link id="' + font _control + '" href="https://fonts.googleapis.com/css?family=' + fontName + '%3A' + new _value + '" rel="stylesheet">' ;
}
}
// Concat and append new <style>.
jQuery ( 'head' ) . append (
'<style id="' + control + '-' + css _property + '">'
+ selector + ' { ' + css _property + ': ' + new _value + ' }'
+ '</style>'
+ link
) ;
} else {
// Remove old.
jQuery ( 'style#' + control ) . remove ( ) ;
}
} ) ;
} ) ;
}
/ * *
* Apply CSS for the element
* /
function astra _apply _responsive _background _css ( control , selector , device , singleColorSelector , addon ) {
wp . customize ( control , function ( value ) {
value . bind ( function ( bg _obj ) {
addon = addon || '' ;
singleColorSelector = singleColorSelector || '' ;
addon = ( addon ) ? addon : 'header' ;
control = control . replace ( '[' , '-' ) ;
control = control . replace ( ']' , '' ) ;
if ( '' === bg _obj [ device ] || undefined === bg _obj [ device ] ) {
return ;
}
var gen _bg _css = '' ;
var bg _img = bg _obj [ device ] [ 'background-image' ] ;
var bg _tab _img = bg _obj [ 'tablet' ] [ 'background-image' ] ;
var bg _desk _img = bg _obj [ 'desktop' ] [ 'background-image' ] ;
var bg _color = bg _obj [ device ] [ 'background-color' ] ;
var tablet _css = ( bg _obj [ 'tablet' ] [ 'background-image' ] ) ? true : false ;
var desktop _css = ( bg _obj [ 'desktop' ] [ 'background-image' ] ) ? true : false ;
if ( undefined !== bg _obj [ device ] [ 'background-type' ] && '' !== bg _obj [ device ] [ 'background-type' ] ) {
if ( ( 'color' === bg _obj [ device ] [ 'background-type' ] ) ) {
if ( '' !== bg _img && '' !== bg _color && undefined !== bg _color && 'unset' !== bg _color ) {
gen _bg _css = 'background-image: linear-gradient(to right, ' + bg _color + ', ' + bg _color + '), url(' + bg _img + ');' ;
} else if ( 'mobile' === device ) {
if ( desktop _css ) {
gen _bg _css = 'background-image: linear-gradient(to right, ' + bg _color + ', ' + bg _color + '), url(' + bg _desk _img + ');' ;
} else if ( tablet _css ) {
gen _bg _css = 'background-image: linear-gradient(to right, ' + bg _color + ', ' + bg _color + '), url(' + bg _tab _img + ');' ;
} else {
gen _bg _css = 'background-color: ' + bg _color + ';' ;
gen _bg _css += 'background-image: none;' ;
}
} else if ( 'tablet' === device ) {
if ( desktop _css ) {
gen _bg _css = 'background-image: linear-gradient(to right, ' + bg _color + ', ' + bg _color + '), url(' + bg _desk _img + ');' ;
} else {
gen _bg _css = 'background-color: ' + bg _color + ';' ;
gen _bg _css += 'background-image: none;' ;
}
} else if ( undefined === bg _img || '' === bg _img ) {
gen _bg _css = 'background-color: ' + bg _color + ';' ;
gen _bg _css += 'background-image: none;' ;
}
} else if ( 'image' === bg _obj [ device ] [ 'background-type' ] ) {
if ( '' !== bg _img ) {
if ( undefined !== bg _obj [ device ] [ 'overlay-type' ] && 'none' !== bg _obj [ device ] [ 'overlay-type' ] ) {
let overlay _color = undefined !== bg _obj [ device ] [ 'overlay-color' ] ? bg _obj [ device ] [ 'overlay-color' ] : '' ;
let overlay _opacity = undefined !== bg _obj [ device ] [ 'overlay-opacity' ] ? bg _obj [ device ] [ 'overlay-opacity' ] : '' ;
let overlay _gradient = undefined !== bg _obj [ device ] [ 'overlay-gradient' ] ? bg _obj [ device ] [ 'overlay-gradient' ] : '' ;
if ( 'classic' === bg _obj [ device ] [ 'overlay-type' ] && '' !== overlay _color ) {
if ( '' !== overlay _opacity ) {
wp . customize . preview . send ( 'refresh' ) ;
return ;
}
gen _bg _css = 'background-image: linear-gradient(to right, ' + overlay _color + ', ' + overlay _color + '), url(' + bg _img + ');' ;
} else if ( 'gradient' === bg _obj [ device ] [ 'overlay-type' ] && '' !== overlay _gradient ) {
gen _bg _css = 'background-image: ' + overlay _gradient + ', url(' + bg _img + ');' ;
} else {
gen _bg _css = 'background-image: url(' + bg _img + ');' ;
}
} else {
gen _bg _css = 'background-image: url(' + bg _img + ');' ;
}
}
} else if ( 'gradient' === bg _obj [ device ] [ 'background-type' ] ) {
if ( '' !== bg _color && 'unset' !== bg _color ) {
gen _bg _css = 'background-image: ' + bg _color + ';' ;
}
}
}
if ( '' !== bg _img ) {
gen _bg _css += 'background-repeat: ' + bg _obj [ device ] [ 'background-repeat' ] + ';' ;
gen _bg _css += 'background-position: ' + bg _obj [ device ] [ 'background-position' ] + ';' ;
gen _bg _css += 'background-size: ' + bg _obj [ device ] [ 'background-size' ] + ';' ;
gen _bg _css += 'background-attachment: ' + bg _obj [ device ] [ 'background-attachment' ] + ';' ;
}
// Remove old.
jQuery ( 'style#' + control + '-' + device + '-' + addon ) . remove ( ) ;
if ( 'desktop' == device ) {
var dynamicStyle = '<style id="' + control + '-' + device + '-' + addon + '">'
+ selector + ' { ' + gen _bg _css + ' }'
+ '</style>'
}
if ( 'tablet' == device ) {
var dynamicStyle = '<style id="' + control + '-' + device + '-' + addon + '">'
+ '@media (max-width: 768px) {' + selector + ' { ' + gen _bg _css + ' } }'
+ '</style>'
}
if ( 'mobile' == device ) {
var dynamicStyle = '<style id="' + control + '-' + device + '-' + addon + '">'
+ '@media (max-width: 544px) {' + selector + ' { ' + gen _bg _css + ' } }'
+ '</style>'
}
// Concat and append new <style>.
jQuery ( 'head' ) . append (
dynamicStyle
) ;
} ) ;
} ) ;
}
function getChangedKey ( value , other ) {
value = isJsonString ( value ) ? JSON . parse ( value ) : value ;
other = isJsonString ( other ) ? JSON . parse ( other ) : other ;
// Compare two items
var compare = function ( item1 , item2 ) {
// Get the object type
var itemType = Object . prototype . toString . call ( item1 ) ;
// If an object or array, compare recursively
if ( [ '[object Array]' , '[object Object]' ] . indexOf ( itemType ) >= 0 ) {
if ( 'string' == typeof getChangedKey ( item1 , item2 ) ) {
return false ;
}
}
// Otherwise, do a simple comparison
else {
// If the two items are not the same type, return false
if ( itemType !== Object . prototype . toString . call ( item2 ) ) return false ;
// Else if it's a function, convert to a string and compare
// Otherwise, just compare
if ( itemType === '[object Function]' ) {
if ( item1 . toString ( ) !== item2 . toString ( ) ) return false ;
} else {
if ( item1 !== item2 ) return false ;
}
}
} ;
for ( var key in value ) {
if ( other . hasOwnProperty ( key ) && value . hasOwnProperty ( key ) ) {
if ( compare ( value [ key ] , other [ key ] ) === false ) return key ;
} else {
return key ;
}
}
// If nothing failed, return true
return true ;
}
function isJsonString ( str ) {
try {
JSON . parse ( str ) ;
} catch ( e ) {
return false ;
}
return true ;
}
function hasWordPressWidgetBlockEditor ( ) {
return astraCustomizer . has _block _editor _support || false ;
}
( function ( $ ) {
/ *
* Site Identity SVG Logo initial styling .
* /
wp . customize ( 'astra-settings[logo-svg-icon]' , function ( setting ) {
setting . bind ( function ( ) {
astra _add _dynamic _css (
'ast-header-responsive-logo-svg-icon-width' ,
'.ast-logo-title-inline .ast-site-identity { gap: 5px; } #masthead .ast-logo-svg-icon svg, .ast-sg-logo-section .ast-logo-svg-icon svg { width: 30px; }'
) ;
} ) ;
} ) ;
/ *
* Site Identity Logo Width
* /
wp . customize ( 'astra-settings[ast-header-responsive-logo-width]' , function ( setting ) {
setting . bind ( function ( logo _width ) {
let tabletBreakPoint = astraCustomizer . tablet _breakpoint || 921 ,
mobileBreakPoint = astraCustomizer . mobile _breakpoint || 544 ;
if ( logo _width [ 'desktop' ] != '' || logo _width [ 'tablet' ] != '' || logo _width [ 'mobile' ] != '' ) {
var dynamicStyle = ` #masthead .site-logo-img .custom-logo-link img, .ast-sg-logo-section .site-logo-img .custom-logo-link img {
max - width : $ { logo _width [ 'desktop' ] } px ;
width : $ { logo _width [ 'desktop' ] } px ;
}
@ media ( max - width : $ { tabletBreakPoint } px ) {
# masthead . site - logo - img . custom - logo - link img , . ast - sg - logo - section . site - logo - img . custom - logo - link img {
max - width : $ { logo _width [ 'tablet' ] } px ;
width : $ { logo _width [ 'tablet' ] } px ;
}
# masthead . site - logo - img img {
max - width : $ { logo _width [ 'tablet' ] } px ;
width : $ { logo _width [ 'tablet' ] } px ;
}
}
@ media ( max - width : $ { mobileBreakPoint } px ) {
# masthead . site - logo - img . custom - logo - link img , . ast - sg - logo - section . site - logo - img . custom - logo - link img {
max - width : $ { logo _width [ 'mobile' ] } px ;
width : $ { logo _width [ 'mobile' ] } px ;
}
# masthead . site - logo - img img {
max - width : $ { logo _width [ 'mobile' ] } px ;
max - height : $ { logo _width [ 'mobile' ] } px ;
}
} ` ;
astra _add _dynamic _css ( 'ast-header-responsive-logo-width' , dynamicStyle ) ;
var mobileLogoStyle = '.ast-header-break-point #masthead .site-logo-img .custom-mobile-logo-link img, .ast-header-break-point .ast-sg-logo-section .site-logo-img .custom-mobile-logo-link img { max-width: ' + logo _width [ 'tablet' ] + 'px; } @media( max-width: ' + tabletBreakPoint + 'px ) { .ast-header-break-point #masthead .site-logo-img .custom-mobile-logo-link img, .ast-header-break-point .ast-sg-logo-section .site-logo-img .custom-mobile-logo-link img { max-width: ' + logo _width [ 'tablet' ] + 'px; } @media( max-width: ' + mobileBreakPoint + 'px ) { .ast-header-break-point #masthead .site-logo-img .custom-mobile-logo-link img { max-width: ' + logo _width [ 'mobile' ] + 'px; }' ;
astra _add _dynamic _css ( 'mobile-header-logo-width' , mobileLogoStyle ) ;
/ * *
* Logo SVG Icon Stylings .
* /
var logoSVGIconStyles = '#masthead .ast-logo-svg-icon svg, .ast-sg-logo-section .ast-logo-svg-icon svg { width: ' + logo _width [ 'desktop' ] + 'px; } @media( max-width: ' + tabletBreakPoint + 'px ) { #masthead .ast-logo-svg-icon svg, .ast-sg-logo-section .ast-logo-svg-icon svg { width: ' + logo _width [ 'tablet' ] + 'px; } #masthead .ast-logo-svg-icon svg, .ast-sg-logo-section .ast-logo-svg-icon svg { width: ' + logo _width [ 'tablet' ] + 'px; } } @media( max-width: ' + mobileBreakPoint + 'px ) { #masthead .ast-logo-svg-icon svg, .ast-sg-logo-section .ast-logo-svg-icon svg { width: ' + logo _width [ 'mobile' ] + 'px; }' + '#masthead .ast-logo-svg-icon svg, .ast-sg-logo-section .ast-logo-svg-icon svg { width: ' + logo _width [ 'mobile' ] + 'px; } }' ;
astra _add _dynamic _css ( 'ast-header-responsive-logo-svg-icon-width' , logoSVGIconStyles ) ;
} else {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
/ *
* SVG Site Logo Gap
* /
wp . customize ( 'astra-settings[logo-svg-site-title-gap]' , function ( setting ) {
setting . bind ( function ( logoGap ) {
let tabletBreakPoint = astraCustomizer . tablet _breakpoint || 921 ,
mobileBreakPoint = astraCustomizer . mobile _breakpoint || 544 ;
if ( logoGap [ 'desktop' ] != '' || logoGap [ 'tablet' ] != '' || logoGap [ 'mobile' ] != '' ) {
var dynamicStyle = ` .ast-logo-title-inline .ast-site-identity {
gap : $ { logoGap [ 'desktop' ] } px ;
}
@ media ( max - width : $ { tabletBreakPoint } px ) {
. ast - logo - title - inline . ast - site - identity {
gap : $ { logoGap [ 'tablet' ] } px ;
}
}
@ media ( max - width : $ { mobileBreakPoint } px ) {
. ast - logo - title - inline . ast - site - identity {
gap : $ { logoGap [ 'mobile' ] } px ;
}
} ` ;
astra _add _dynamic _css ( 'logo-svg-site-title-gap' , dynamicStyle ) ;
} else {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
/ *
* Responsive Logo Visibility
* /
wp . customize ( 'astra-settings[display-site-title-responsive]' , function ( setting ) {
setting . bind ( function ( logo _visibility ) {
var desktopTitleVisibility = ( logo _visibility [ 'desktop' ] ) ? 'block' : 'none' ;
var tabletTitleVisibility = ( logo _visibility [ 'tablet' ] ) ? 'block' : 'none' ;
var mobileTitleVisibility = ( logo _visibility [ 'mobile' ] ) ? 'block' : 'none' ;
var tabletBreakPoint = astraBuilderPreview . tablet _break _point || 921 ,
mobileBreakPoint = astraBuilderPreview . mobile _break _point || 544 ;
var dynamicStyle = '.ast-site-title-wrap .site-title { display: ' + desktopTitleVisibility + ';} @media( max-width: ' + tabletBreakPoint + 'px) { .ast-site-title-wrap .site-title { display: ' + tabletTitleVisibility + ';} } @media( max-width: ' + mobileBreakPoint + 'px) { .ast-site-title-wrap .site-title { display: ' + mobileTitleVisibility + ';} }' ;
astra _add _dynamic _css ( 'display-site-title-responsive' , dynamicStyle ) ;
} ) ;
} ) ;
/ *
* Responsive Tagline Visibility
* /
wp . customize ( 'astra-settings[display-site-tagline-responsive]' , function ( setting ) {
setting . bind ( function ( tagline _visibility ) {
var desktopTaglineVisibility = ( tagline _visibility [ 'desktop' ] ) ? 'block' : 'none' ;
var tabletTaglineVisibility = ( tagline _visibility [ 'tablet' ] ) ? 'block' : 'none' ;
var mobileTaglineVisibility = ( tagline _visibility [ 'mobile' ] ) ? 'block' : 'none' ;
var tabletBreakPoint = astraBuilderPreview . tablet _break _point || 768 ,
mobileBreakPoint = astraBuilderPreview . mobile _break _point || 544 ;
var dynamicStyle = '.ast-site-title-wrap .site-description { display: ' + desktopTaglineVisibility + ';} @media( max-width: ' + tabletBreakPoint + 'px) { .ast-site-title-wrap .site-description { display: ' + tabletTaglineVisibility + ';} } @media( max-width: ' + mobileBreakPoint + 'px) { .ast-site-title-wrap .site-description { display: ' + mobileTaglineVisibility + ';} }' ;
astra _add _dynamic _css ( 'display-site-tagline-responsive' , dynamicStyle ) ;
} ) ;
} ) ;
/ *
* Full width layout
* /
wp . customize ( 'astra-settings[site-content-width]' , function ( setting ) {
setting . bind ( function ( width ) {
var dynamicStyle = '@media (min-width: 554px) {' ;
dynamicStyle += '.ast-container, .fl-builder #content .entry-header { max-width: ' + ( 40 + parseInt ( width ) ) + 'px } ' ;
dynamicStyle += '}' ;
if ( jQuery ( 'body' ) . hasClass ( 'ast-page-builder-template' ) ) {
dynamicStyle += '@media (min-width: 554px) {' ;
dynamicStyle += '.ast-page-builder-template .comments-area { max-width: ' + ( 40 + parseInt ( width ) ) + 'px } ' ;
dynamicStyle += '}' ;
}
astra _add _dynamic _css ( 'site-content-width' , dynamicStyle ) ;
} ) ;
} ) ;
/ *
* Full width layout
* /
wp . customize ( 'astra-settings[header-main-menu-label]' , function ( setting ) {
setting . bind ( function ( label ) {
if ( $ ( 'button.main-header-menu-toggle .mobile-menu-wrap .mobile-menu' ) . length > 0 ) {
if ( label != '' ) {
$ ( 'button.main-header-menu-toggle .mobile-menu-wrap .mobile-menu' ) . text ( label ) ;
} else {
$ ( 'button.main-header-menu-toggle .mobile-menu-wrap' ) . remove ( ) ;
}
} else {
var html = $ ( 'button.main-header-menu-toggle' ) . html ( ) ;
if ( '' != label ) {
html += '<div class="mobile-menu-wrap"><span class="mobile-menu">' + label + '</span> </div>' ;
}
$ ( 'button.main-header-menu-toggle' ) . html ( html )
}
} ) ;
} ) ;
/ * *
* Apply content bg responsive css with specified selector .
* @ param { string } selector
* @ returns { void }
* /
const apply _content _bg = ( selector ) => {
astra _apply _responsive _background _css ( 'astra-settings[content-bg-obj-responsive]' , selector , 'desktop' ) ;
astra _apply _responsive _background _css ( 'astra-settings[content-bg-obj-responsive]' , selector , 'tablet' ) ;
astra _apply _responsive _background _css ( 'astra-settings[content-bg-obj-responsive]' , selector , 'mobile' ) ;
}
/ *
* Layout Body Background
* /
astra _apply _responsive _background _css ( 'astra-settings[site-layout-outside-bg-obj-responsive]' , 'body, .ast-separate-container' , 'desktop' ) ;
astra _apply _responsive _background _css ( 'astra-settings[site-layout-outside-bg-obj-responsive]' , 'body, .ast-separate-container' , 'tablet' ) ;
astra _apply _responsive _background _css ( 'astra-settings[site-layout-outside-bg-obj-responsive]' , 'body, .ast-separate-container' , 'mobile' ) ;
if ( astraCustomizer . is _content _bg _option _to _load ) {
var content _layout = astraCustomizer . content _layout ;
var site _layout = astraCustomizer . site _layout ;
var blog _grid = ( typeof ( wp . customize . _value [ 'astra-settings[blog-grid]' ] ) != 'undefined' ) ? wp . customize . _value [ 'astra-settings[blog-grid]' ] . _value : 1 ;
var blog _layout = ( typeof ( wp . customize . _value [ 'astra-settings[blog-layout]' ] ) != 'undefined' ) ? wp . customize . _value [ 'astra-settings[blog-layout]' ] . _value : 'blog-layout-1' ;
var dynamicSelector = '.ast-separate-container .ast-article-single:not(.ast-related-post), .ast-separate-container .comments-area .comment-respond,.ast-separate-container .comments-area .ast-comment-list li, .ast-separate-container .ast-woocommerce-container, .ast-separate-container .error-404, .ast-separate-container .no-results, .single.ast-separate-container .site-main .ast-author-meta, .ast-separate-container .related-posts, .ast-separate-container .comments-count-wrapper, .ast-separate-container .comments-area .comments-title, .ast-single-related-posts-container, .ast-plain-container, .site-content article .ast-article-inner' ;
if ( 'blog-layout-1' == blog _layout && 1 != blog _grid ) {
dynamicSelector += ', .ast-separate-container .ast-article-inner' ;
}
/ * *
* Content background color
* /
if ( 'boxed-container' == content _layout ) {
// Case: Container -> Boxed, Site-Layout -> Any.
dynamicSelector += ', .ast-separate-container.ast-two-container #secondary .widget' ;
apply _content _bg ( dynamicSelector ) ;
}
else if ( 'content-boxed-container' == content _layout ) {
// Case: Container -> Content-Boxed, Site-Layout -> Any.
apply _content _bg ( dynamicSelector ) ;
} else if ( astraCustomizer . apply _content _bg _fullwidth _layouts && ( 'ast-box-layout' === site _layout || 'ast-padded-layout' === site _layout ) && ( 'plain-container' === content _layout ) ) {
// Case: Container -> FW Contained, Site-Layout -> Max, Padded.
var fullWidthLayoutSelector = '.ast-box-layout.ast-plain-container .site-content, .ast-padded-layout.ast-plain-container .site-content' ;
apply _content _bg ( fullWidthLayoutSelector ) ;
}
else if ( astraCustomizer . apply _content _bg _fullwidth _layouts && ( 'plain-container' === content _layout ) ) {
// Case: Container -> FW Contained, Site-Layout -> Full-Width, Theme default.
dynamicSelector += ', .ast-plain-container .site-content' ;
apply _content _bg ( dynamicSelector ) ;
}
else if ( astraCustomizer . apply _content _bg _fullwidth _layouts && ( 'page-builder' == content _layout ) && ( 'ast-box-layout' !== site _layout && 'ast-padded-layout' !== site _layout ) ) {
// Case: Container -> FW Stretched, Site-Layout -> Full-Width, Theme default.
dynamicSelector += ', .ast-page-builder-template .site-content' ;
apply _content _bg ( dynamicSelector ) ;
}
}
wp . customize ( 'astra-settings[content-bg-obj-responsive]' , function ( setting ) {
setting . bind ( function ( color ) {
if ( 'narrow-container' == content _layout ) {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
/ *
* Blog Custom Width
* /
wp . customize ( 'astra-settings[blog-max-width]' , function ( setting ) {
setting . bind ( function ( width ) {
var dynamicStyle = '@media all and ( min-width: 921px ) {' ;
if ( ! jQuery ( 'body' ) . hasClass ( 'ast-woo-shop-archive' ) ) {
dynamicStyle += '.blog .site-content > .ast-container,.archive .site-content > .ast-container{ max-width: ' + ( parseInt ( width ) ) + 'px } ' ;
}
if ( jQuery ( 'body' ) . hasClass ( 'ast-fluid-width-layout' ) ) {
dynamicStyle += '.blog .site-content > .ast-container,.archive .site-content > .ast-container{ padding-left:20px; padding-right:20px; } ' ;
}
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'blog-max-width' , dynamicStyle ) ;
} ) ;
} ) ;
/ *
* Single Blog Custom Width
* /
wp . customize ( 'astra-settings[blog-single-max-width]' , function ( setting ) {
setting . bind ( function ( width ) {
var dynamicStyle = '@media all and ( min-width: 921px ) {' ;
dynamicStyle += '.single-post .site-content > .ast-container{ max-width: ' + ( 40 + parseInt ( width ) ) + 'px } ' ;
if ( jQuery ( 'body' ) . hasClass ( 'ast-fluid-width-layout' ) ) {
dynamicStyle += '.single-post .site-content > .ast-container{ padding-left:20px; padding-right:20px; } ' ;
}
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'blog-single-max-width' , dynamicStyle ) ;
} ) ;
} ) ;
/ *
* Single Blog Custom Width
* /
wp . customize ( 'astra-settings[page-single-max-width]' , function ( setting ) {
setting . bind ( function ( width ) {
var dynamicStyle = '@media all and ( min-width: 921px ) {' ;
dynamicStyle += '.page .site-content > .ast-container{ max-width: ' + ( 40 + parseInt ( width ) ) + 'px } ' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'page-single-max-width' , dynamicStyle ) ;
} ) ;
} ) ;
/ *
* EDD Archive Custom Width
* /
wp . customize ( 'astra-settings[edd-archive-max-width]' , function ( setting ) {
setting . bind ( function ( width ) {
var dynamicStyle = '.ast-edd-archive-page .site-content > .ast-container { max-width: ' + parseInt ( width ) + 'px } ' ;
astra _add _dynamic _css ( 'edd-archive-max-width' , dynamicStyle ) ;
} ) ;
} ) ;
/ * *
* Primary Width Option
* /
wp . customize ( 'astra-settings[site-sidebar-width]' , function ( setting ) {
setting . bind ( function ( width ) {
if ( ! jQuery ( 'body' ) . hasClass ( 'ast-no-sidebar' ) && width >= 15 && width <= 50 ) {
var dynamicStyle = '@media (min-width: 769px) {' ;
dynamicStyle += '#primary { width: ' + ( 100 - parseInt ( width ) ) + '% } ' ;
dynamicStyle += '#secondary { width: ' + width + '% } ' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'site-sidebar-width' , dynamicStyle ) ;
}
} ) ;
} ) ;
/ * *
* Header Bottom Border
* /
wp . customize ( 'astra-settings[header-main-sep]' , function ( setting ) {
setting . bind ( function ( border ) {
var dynamicStyle = 'body.ast-header-break-point .main-header-bar { border-bottom-width: ' + border + 'px }' ;
dynamicStyle += '.ast-desktop .main-header-bar {' ;
dynamicStyle += 'border-bottom-width: ' + border + 'px' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'header-main-sep' , dynamicStyle ) ;
} ) ;
} ) ;
/ * *
* Small Footer Top Border
* /
wp . customize ( 'astra-settings[footer-sml-divider]' , function ( value ) {
value . bind ( function ( border _width ) {
jQuery ( '.ast-small-footer' ) . css ( 'border-top-width' , border _width + 'px' ) ;
} ) ;
} ) ;
/ * *
* Footer Widget Top Border
* /
wp . customize ( 'astra-settings[footer-adv-border-width]' , function ( value ) {
value . bind ( function ( border _width ) {
jQuery ( '.footer-adv .footer-adv-overlay' ) . css ( 'border-top-width' , border _width + 'px' ) ;
} ) ;
} ) ;
wp . customize ( 'astra-settings[footer-adv-border-color]' , function ( value ) {
value . bind ( function ( border _color ) {
jQuery ( '.footer-adv .footer-adv-overlay' ) . css ( 'border-top-color' , border _color ) ;
} ) ;
} ) ;
/ * *
* Small Footer Top Border Color
* /
wp . customize ( 'astra-settings[footer-sml-divider-color]' , function ( value ) {
value . bind ( function ( border _color ) {
jQuery ( '.ast-small-footer' ) . css ( 'border-top-color' , border _color ) ;
} ) ;
} ) ;
// WooCommerce global button compatibility for new users only.
const woo _btn _normal _sector = astraCustomizer . astra _woo _btn _global _compatibility ? ', .woocommerce a.button, .woocommerce .widget_price_filter .button, .woocommerce button.button, [CLASS*="wc-block"] button' : '' ;
const woo _btn _hover _sector = astraCustomizer . astra _woo _btn _global _compatibility ? ', .woocommerce a.button:hover, .woocommerce .widget_price_filter .button:hover, .woocommerce button.button:hover, [CLASS*="wc-block"] button:hover' : '' ;
// LifterLMS customizer compatibility selector.
const lifterLMSBtnSelector = astraCustomizer . isLifterLMS ? ', .lifterlms a.llms-button-primary, .lifterlms a.llms-button-secondary, .lifterlms .llms-button-action, .lifterlms button.llms-field-button, .lifterlms a.llms-field-button' : '' ;
const lifterLMSBtnHSelector = astraCustomizer . isLifterLMS ? ', .lifterlms a.llms-button-primary:hover, .lifterlms a.llms-button-primary:focus, .lifterlms a.llms-button-secondary:hover, .lifterlms a.llms-button-secondary:focus, .lifterlms .llms-button-action:hover, .lifterlms .llms-button-action:focus, .lifterlms button.llms-field-button:hover, .lifterlms button.llms-field-button:focus, .lifterlms a.llms-field-button:hover, .lifterlms a.llms-field-button:focus' : '' ;
/ * *
* Button Border Radius Fields
* /
wp . customize ( 'astra-settings[button-radius-fields]' , function ( setting ) {
setting . bind ( function ( border ) {
let tabletBreakPoint = astraBuilderPreview . tablet _break _point || 768 ,
mobileBreakPoint = astraBuilderPreview . mobile _break _point || 544 ;
let search _button _selector = hasWordPressWidgetBlockEditor ( ) ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button' : '' ;
let lmsButtonSelectors = ', body #ld_course_list .btn, body a.btn-blue, body a.btn-blue:visited, body a#quiz_continue_link, body .btn-join, body .learndash_checkout_buttons input.btn-join[type="button"], body #btn-join, body .learndash_checkout_buttons input.btn-join[type="submit"], body .wpProQuiz_content .wpProQuiz_button2, a.llms-button-primary, .llms-button-secondary, .llms-button-action, .llms-field-button, .llms-button-action.large' ;
let globalSelector = '.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .wp-block-button:not(.is-style-outline) .wp-block-button__link' + astraCustomizer . v4 _2 _2 _core _form _btns _styling +
lmsButtonSelectors + search _button _selector + woo _btn _normal _sector + lifterLMSBtnSelector ;
if ( document . body . classList . contains ( 'edd-page' ) ) {
globalSelector += ', .ast-edd-site-header-cart .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a ' ;
}
let dynamicStyle = globalSelector + '{ border-top-left-radius :' + border [ 'desktop' ] [ 'top' ] + border [ 'desktop-unit' ]
+ '; border-bottom-right-radius :' + border [ 'desktop' ] [ 'bottom' ] + border [ 'desktop-unit' ] + '; border-bottom-left-radius :'
+ border [ 'desktop' ] [ 'left' ] + border [ 'desktop-unit' ] + '; border-top-right-radius :' + border [ 'desktop' ] [ 'right' ] + border [ 'desktop-unit' ] + '; } ' ;
dynamicStyle += '@media (max-width: ' + tabletBreakPoint + 'px) { ' + globalSelector + '{ border-top-left-radius :' + border [ 'tablet' ] [ 'top' ] + border [ 'tablet-unit' ]
+ '; border-bottom-right-radius :' + border [ 'tablet' ] [ 'bottom' ] + border [ 'tablet-unit' ] + '; border-bottom-left-radius :'
+ border [ 'tablet' ] [ 'left' ] + border [ 'tablet-unit' ] + '; border-top-right-radius :' + border [ 'tablet' ] [ 'right' ] + border [ 'tablet-unit' ] + '; } } ' ;
dynamicStyle += '@media (max-width: ' + mobileBreakPoint + 'px) { ' + globalSelector + '{ border-top-left-radius :' + border [ 'mobile' ] [ 'top' ] + border [ 'mobile-unit' ]
+ '; border-bottom-right-radius :' + border [ 'mobile' ] [ 'bottom' ] + border [ 'mobile-unit' ] + '; border-bottom-left-radius :'
+ border [ 'mobile' ] [ 'left' ] + border [ 'mobile-unit' ] + '; border-top-right-radius :' + border [ 'mobile' ] [ 'right' ] + border [ 'mobile-unit' ] + '; } } ' ;
astra _add _dynamic _css ( 'button-radius' , dynamicStyle ) ;
} ) ;
} ) ;
/ * *
* Button Border Radius Fields
* /
wp . customize ( 'astra-settings[secondary-button-radius-fields]' , function ( setting ) {
setting . bind ( function ( border ) {
let tabletBreakPoint = astraBuilderPreview . tablet _break _point || 768 ,
mobileBreakPoint = astraBuilderPreview . mobile _break _point || 544 ;
if ( "" === border ) {
return ;
}
let globalSelector = '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link.wp-element-button, .ast-outline-button, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button' ;
let dynamicStyle = globalSelector + '{ border-top-left-radius :' + border [ 'desktop' ] [ 'top' ] + border [ 'desktop-unit' ]
+ '; border-bottom-right-radius :' + border [ 'desktop' ] [ 'bottom' ] + border [ 'desktop-unit' ] + '; border-bottom-left-radius :'
+ border [ 'desktop' ] [ 'left' ] + border [ 'desktop-unit' ] + '; border-top-right-radius :' + border [ 'desktop' ] [ 'right' ] + border [ 'desktop-unit' ] + '; } ' ;
dynamicStyle += '@media (max-width: ' + tabletBreakPoint + 'px) { ' + globalSelector + '{ border-top-left-radius :' + border [ 'tablet' ] [ 'top' ] + border [ 'tablet-unit' ]
+ '; border-bottom-right-radius :' + border [ 'tablet' ] [ 'bottom' ] + border [ 'tablet-unit' ] + '; border-bottom-left-radius :'
+ border [ 'tablet' ] [ 'left' ] + border [ 'tablet-unit' ] + '; border-top-right-radius :' + border [ 'tablet' ] [ 'right' ] + border [ 'tablet-unit' ] + '; } } ' ;
dynamicStyle += '@media (max-width: ' + mobileBreakPoint + 'px) { ' + globalSelector + '{ border-top-left-radius :' + border [ 'mobile' ] [ 'top' ] + border [ 'mobile-unit' ]
+ '; border-bottom-right-radius :' + border [ 'mobile' ] [ 'bottom' ] + border [ 'mobile-unit' ] + '; border-bottom-left-radius :'
+ border [ 'mobile' ] [ 'left' ] + border [ 'mobile-unit' ] + '; border-top-right-radius :' + border [ 'mobile' ] [ 'right' ] + border [ 'mobile-unit' ] + '; } } ' ;
astra _add _dynamic _css ( 'secondary-button-radius' , dynamicStyle ) ;
} ) ;
} ) ;
/ * *
* Header Bottom Border width
* /
wp . customize ( 'astra-settings[header-main-sep]' , function ( value ) {
value . bind ( function ( border ) {
var dynamicStyle = ' body.ast-header-break-point .main-header-bar { border-bottom-width: ' + border + 'px } ' ;
dynamicStyle += '.ast-desktop .main-header-bar {' ;
dynamicStyle += 'border-bottom-width: ' + border + 'px' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'header-main-sep' , dynamicStyle ) ;
} ) ;
} ) ;
/ * *
* Header Bottom Border color
* /
wp . customize ( 'astra-settings[header-main-sep-color]' , function ( value ) {
value . bind ( function ( color ) {
if ( color == '' ) {
wp . customize . preview . send ( 'refresh' ) ;
}
if ( color ) {
var dynamicStyle = ' .ast-desktop .main-header-bar { border-bottom-color: ' + color + '; } ' ;
dynamicStyle += ' body.ast-header-break-point .main-header-bar { border-bottom-color: ' + color + '; } ' ;
astra _add _dynamic _css ( 'header-main-sep-color' , dynamicStyle ) ;
}
} ) ;
} ) ;
/ * *
* Primary Toggle Button Color
* /
wp . customize ( 'astra-settings[mobile-header-toggle-btn-style-color]' , function ( setting ) {
setting . bind ( function ( toggle _button _color ) {
if ( toggle _button _color != '' ) {
if ( jQuery ( '.menu-toggle' ) . hasClass ( 'ast-mobile-menu-buttons-fill' ) ) {
var dynamicStyle = '.ast-header-break-point .ast-mobile-menu-buttons-fill.menu-toggle { background: ' + toggle _button _color + '}' ;
}
else if ( jQuery ( '.menu-toggle' ) . hasClass ( 'ast-mobile-menu-buttons-outline' ) ) {
var dynamicStyle = '.ast-header-break-point .ast-mobile-menu-buttons-outline.menu-toggle { border: 1px solid ' + toggle _button _color + '; color: ' + toggle _button _color + '}' ;
}
else {
var dynamicStyle = '.ast-header-break-point .ast-mobile-menu-buttons-minimal.menu-toggle { color: ' + toggle _button _color + '}' ;
}
astra _add _dynamic _css ( 'primary-toggle-button-color' , dynamicStyle ) ;
}
else {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
astra _responsive _font _size ( 'astra-settings[font-size-site-tagline]' , '.ast-sg-logo-section .site-description, .site-header .site-description' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-site-title]' , '.site-title' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-page-title]' , 'body:not(.ast-single-post) .entry-title' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-post-meta]' , '.entry-meta, .read-more' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-post-tax]' , '.ast-blog-single-element.ast-taxonomy-container a' ) ;
astra _refresh _customizer ( 'astra-settings[blog-meta-category-style]' ) ;
astra _refresh _customizer ( 'astra-settings[blog-category-style]' ) ;
astra _refresh _customizer ( 'astra-settings[blog-tag-style]' ) ;
astra _refresh _customizer ( 'astra-settings[blog-post-meta-divider-type]' ) ;
astra _refresh _customizer ( 'astra-settings[blog-meta-tag-style]' ) ;
astra _refresh _customizer ( 'astra-settings[blog-post-content]' ) ;
wp . customize ( 'astra-settings[post-card-border-radius]' , function ( setting ) {
setting . bind ( function ( border ) {
let desktopTop = border [ 'desktop' ] [ 'top' ] ? border [ 'desktop' ] [ 'top' ] : 0 ,
desktopBottom = border [ 'desktop' ] [ 'bottom' ] ? border [ 'desktop' ] [ 'bottom' ] : 0 ,
desktopLeft = border [ 'desktop' ] [ 'left' ] ? border [ 'desktop' ] [ 'left' ] : 0 ,
desktopRight = border [ 'desktop' ] [ 'right' ] ? border [ 'desktop' ] [ 'right' ] : 0 ,
tabletTop = border [ 'tablet' ] [ 'top' ] ? border [ 'tablet' ] [ 'top' ] : 0 ,
tabletBottom = border [ 'tablet' ] [ 'bottom' ] ? border [ 'tablet' ] [ 'bottom' ] : 0 ,
tabletLeft = border [ 'tablet' ] [ 'left' ] ? border [ 'tablet' ] [ 'left' ] : 0 ,
tabletRight = border [ 'tablet' ] [ 'right' ] ? border [ 'tablet' ] [ 'right' ] : 0 ,
mobileTop = border [ 'mobile' ] [ 'top' ] ? border [ 'mobile' ] [ 'top' ] : 0 ,
mobileBottom = border [ 'mobile' ] [ 'bottom' ] ? border [ 'mobile' ] [ 'bottom' ] : 0 ,
mobileLeft = border [ 'mobile' ] [ 'left' ] ? border [ 'mobile' ] [ 'left' ] : 0 ,
mobileRight = border [ 'mobile' ] [ 'right' ] ? border [ 'mobile' ] [ 'right' ] : 0 ;
let tabletBreakPoint = astraBuilderPreview . tablet _break _point || 921 ,
mobileBreakPoint = astraBuilderPreview . mobile _break _point || 544 ,
blog _layout = ( typeof ( wp . customize . _value [ 'astra-settings[blog-layout]' ] ) != 'undefined' ) ? wp . customize . _value [ 'astra-settings[blog-layout]' ] . _value : 'blog-layout-1' ;
let globalSelector = 'blog-layout-5' === blog _layout ? '.archive .ast-article-post, .blog .ast-article-post, .archive .ast-article-post:hover, .blog .ast-article-post:hover' : '.archive .ast-article-post .ast-article-inner, .blog .ast-article-post .ast-article-inner, .archive .ast-article-post .ast-article-inner:hover, .blog .ast-article-post .ast-article-inner:hover' ;
let dynamicStyle = globalSelector + '{ border-top-left-radius :' + desktopTop + border [ 'desktop-unit' ]
+ '; border-bottom-right-radius :' + desktopBottom + border [ 'desktop-unit' ] + '; border-bottom-left-radius :'
+ desktopLeft + border [ 'desktop-unit' ] + '; border-top-right-radius :' + desktopRight + border [ 'desktop-unit' ] + '; } ' ;
dynamicStyle += '@media (max-width: ' + tabletBreakPoint + 'px) { ' + globalSelector + '{ border-top-left-radius :' + tabletTop + border [ 'tablet-unit' ]
+ '; border-bottom-right-radius :' + tabletBottom + border [ 'tablet-unit' ] + '; border-bottom-left-radius :'
+ tabletLeft + border [ 'tablet-unit' ] + '; border-top-right-radius :' + tabletRight + border [ 'tablet-unit' ] + '; } } ' ;
dynamicStyle += '@media (max-width: ' + mobileBreakPoint + 'px) { ' + globalSelector + '{ border-top-left-radius :' + mobileTop + border [ 'mobile-unit' ]
+ '; border-bottom-right-radius :' + mobileBottom + border [ 'mobile-unit' ] + '; border-bottom-left-radius :'
+ mobileLeft + border [ 'mobile-unit' ] + '; border-top-right-radius :' + mobileRight + border [ 'mobile-unit' ] + '; } } ' ;
astra _add _dynamic _css ( 'post-card-border-radius' , dynamicStyle ) ;
} ) ;
} ) ;
// Check if anchors should be loaded in the CSS for headings.
if ( true == astraCustomizer . includeAnchorsInHeadindsCss ) {
2025-08-27 08:44:30 +02:00
astra _responsive _font _size ( 'astra-settings[font-size-h1]' , 'h1, .entry-content :where(h1), .entry-content :where(h1) a' , true , '.ast-sg-typo-field[data-for="h1"] .ast-sg-font-size' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-h2]' , 'h2, .entry-content :where(h2), .entry-content :where(h2) a' , true , '.ast-sg-typo-field[data-for="h2"] .ast-sg-font-size' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-h3]' , 'h3, .entry-content :where(h3), .entry-content :where(h3) a' , true , '.ast-sg-typo-field[data-for="h3"] .ast-sg-font-size' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-h4]' , 'h4, .entry-content :where(h4), .entry-content :where(h4) a' , true , '.ast-sg-typo-field[data-for="h4"] .ast-sg-font-size' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-h5]' , 'h5, .entry-content :where(h5), .entry-content :where(h5) a' , true , '.ast-sg-typo-field[data-for="h5"] .ast-sg-font-size' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-h6]' , 'h6, .entry-content :where(h6), .entry-content :where(h6) a' , true , '.ast-sg-typo-field[data-for="h6"] .ast-sg-font-size' ) ;
2025-07-27 19:55:19 +02:00
} else {
2025-08-27 08:44:30 +02:00
astra _responsive _font _size ( 'astra-settings[font-size-h1]' , 'h1, .entry-content :where(h1)' , true , '.ast-sg-typo-field[data-for="h1"] .ast-sg-font-size' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-h2]' , 'h2, .entry-content :where(h2)' , true , '.ast-sg-typo-field[data-for="h2"] .ast-sg-font-size' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-h3]' , 'h3, .entry-content :where(h3)' , true , '.ast-sg-typo-field[data-for="h3"] .ast-sg-font-size' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-h4]' , 'h4, .entry-content :where(h4)' , true , '.ast-sg-typo-field[data-for="h4"] .ast-sg-font-size' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-h5]' , 'h5, .entry-content :where(h5)' , true , '.ast-sg-typo-field[data-for="h5"] .ast-sg-font-size' ) ;
astra _responsive _font _size ( 'astra-settings[font-size-h6]' , 'h6, .entry-content :where(h6)' , true , '.ast-sg-typo-field[data-for="h6"] .ast-sg-font-size' ) ;
2025-07-27 19:55:19 +02:00
}
// paragraph margin bottom.
wp . customize ( 'astra-settings[para-margin-bottom]' , function ( value ) {
value . bind ( function ( marginBottom ) {
if ( marginBottom == '' ) {
wp . customize . preview . send ( 'refresh' ) ;
}
if ( marginBottom ) {
var dynamicStyle = ' p, .entry-content p { margin-bottom: ' + marginBottom + 'em; } ' ;
astra _add _dynamic _css ( 'para-margin-bottom' , dynamicStyle ) ;
}
} ) ;
} ) ;
// Add preview underline in customizer for content links.
wp . customize ( 'astra-settings[underline-content-links]' , function ( setting ) {
setting . bind ( function ( value ) {
var dynamicStyle = '' ;
if ( value ) {
dynamicStyle = '.ast-single-post .entry-content a, .ast-comment-content a:not(.ast-comment-edit-reply-wrap a), .woocommerce-js .woocommerce-product-details__short-description a { text-decoration: underline; } ' ;
astra _add _dynamic _css ( 'underline-content-links' , dynamicStyle ) ;
} else {
dynamicStyle = '.ast-single-post .entry-content a, .ast-comment-content a:not(.ast-comment-edit-reply-wrap a), .woocommerce-js .woocommerce-product-details__short-description a { text-decoration: unset; } ' ;
astra _add _dynamic _css ( 'underline-content-links' , dynamicStyle ) ;
}
} ) ;
} ) ;
if ( astraCustomizer . page _builder _button _style _css ) {
if ( true == astraCustomizer . includeAnchorsInHeadindsCss ) {
if ( 'color-typo' == astraCustomizer . elementor _default _color _font _setting || 'typo' == astraCustomizer . elementor _default _color _font _setting ) {
astra _css ( 'astra-settings[headings-line-height]' , 'line-height' , '.elementor-widget-heading h1.elementor-heading-title, .elementor-widget-heading h2.elementor-heading-title, .elementor-widget-heading h3.elementor-heading-title, .elementor-widget-heading h4.elementor-heading-title, .elementor-widget-heading h5.elementor-heading-title, .elementor-widget-heading h6.elementor-heading-title' ) ;
}
2025-08-27 08:44:30 +02:00
astra _css ( 'astra-settings[headings-line-height]' , 'line-height' , 'h1, h2, h3, h4, h5, h6, .entry-content :where(h1, h2, h3, h4, h5, h6), .entry-content :where(h1, h2, h3, h4, h5, h6) a, .site-title, .site-title a' ) ;
2025-07-27 19:55:19 +02:00
} else {
if ( 'color-typo' == astraCustomizer . elementor _default _color _font _setting || 'typo' == astraCustomizer . elementor _default _color _font _setting ) {
astra _css ( 'astra-settings[headings-line-height]' , 'line-height' , '.elementor-widget-heading h1.elementor-heading-title, .elementor-widget-heading h2.elementor-heading-title, .elementor-widget-heading h3.elementor-heading-title, .elementor-widget-heading h4.elementor-heading-title, .elementor-widget-heading h5.elementor-heading-title, .elementor-widget-heading h6.elementor-heading-title' ) ;
}
2025-08-27 08:44:30 +02:00
astra _css ( 'astra-settings[headings-line-height]' , 'line-height' , 'h1, .entry-content :where(h1), h2, .entry-content :where(h2), h3, .entry-content :where(h3), h4, .entry-content :where(h4), h5, .entry-content :where(h5), h6, .entry-content :where(h6), .site-title, .site-title a' ) ;
2025-07-27 19:55:19 +02:00
}
} else {
if ( true == astraCustomizer . includeAnchorsInHeadindsCss ) {
2025-08-27 08:44:30 +02:00
astra _css ( 'astra-settings[headings-line-height]' , 'line-height' , 'h1, h2, h3, h4, h5, h6, .entry-content :where(h1, h2, h3, h4, h5, h6), .entry-content :where(h1, h2, h3, h4, h5, h6) a, .site-title, .site-title a' ) ;
2025-07-27 19:55:19 +02:00
} else {
2025-08-27 08:44:30 +02:00
astra _css ( 'astra-settings[headings-line-height]' , 'line-height' , 'h1, h2, h3, h4, h5, h6, .entry-content :where(h1, h2, h3, h4, h5, h6), .site-title, .site-title a' ) ;
2025-07-27 19:55:19 +02:00
}
}
// Check if anchors should be loaded in the CSS for headings.
if ( true == astraCustomizer . includeAnchorsInHeadindsCss ) {
2025-08-27 08:44:30 +02:00
astra _generate _outside _font _family _css ( 'astra-settings[headings-font-family]' , 'h1, h2, h3, h4, h5, h6, .entry-content :where(h1, h2, h3, h4, h5, h6), .entry-content :where(h1, h2, h3, h4, h5, h6) a, .site-title, .site-title a' ) ;
astra _generate _font _weight _css ( 'astra-settings[headings-font-family]' , 'astra-settings[headings-font-weight]' , 'font-weight' , 'h1, h2, h3, h4, h5, h6, .entry-content :where(h1, h2, h3, h4, h5, h6), .entry-content :where(h1, h2, h3, h4, h5, h6) a, .site-title, .site-title a' ) ;
astra _font _extras _css ( 'headings-font-extras' , 'h1, h2, h3, h4, h5, h6, .entry-content :where(h1, h2, h3, h4, h5, h6), .entry-content :where(h1, h2, h3, h4, h5, h6) a, .site-title, .site-title a' ) ;
2025-07-27 19:55:19 +02:00
} else {
2025-08-27 08:44:30 +02:00
astra _generate _outside _font _family _css ( 'astra-settings[headings-font-family]' , 'h1, h2, h3, h4, h5, h6, .entry-content :where(h1, h2, h3, h4, h5, h6), .site-title, .site-title a' ) ;
astra _generate _font _weight _css ( 'astra-settings[headings-font-family]' , 'astra-settings[headings-font-weight]' , 'font-weight' , 'h1, h2, h3, h4, h5, h6, .entry-content :where(h1, h2, h3, h4, h5, h6), .site-title, .site-title a' ) ;
astra _font _extras _css ( 'headings-font-extras' , 'h1, h2, h3, h4, h5, h6, .entry-content :where(h1, h2, h3, h4, h5, h6), .site-title, .site-title a' ) ;
2025-07-27 19:55:19 +02:00
}
// Global link
astra _css ( 'astra-settings[link-color]' , 'color' , '.entry-meta, .entry-meta *' ) ;
astra _css ( 'astra-settings[link-h-color]' , 'color' , '.read-more a:hover, .entry-meta a:hover, .entry-meta a:hover *' ) ;
// Footer Bar.
astra _css ( 'astra-settings[footer-color]' , 'color' , '.ast-small-footer' ) ;
astra _css ( 'astra-settings[footer-link-color]' , 'color' , '.ast-small-footer a' ) ;
astra _css ( 'astra-settings[footer-link-h-color]' , 'color' , '.ast-small-footer a:hover' ) ;
// Footer Bar background.
wp . customize ( 'astra-settings[footer-bg-obj]' , function ( value ) {
value . bind ( function ( bg _obj ) {
var dynamicStyle = ' .ast-small-footer > .ast-footer-overlay { {{css}} }' ;
astra _background _obj _css ( wp . customize , bg _obj , 'footer-bg-obj' , dynamicStyle ) ;
} ) ;
} ) ;
// Footer Widgets.
astra _css ( 'astra-settings[footer-adv-wgt-title-color]' , 'color' , '.footer-adv .widget-title, .footer-adv .widget-title a' ) ;
astra _css ( 'astra-settings[footer-adv-text-color]' , 'color' , '.footer-adv' ) ;
astra _css ( 'astra-settings[footer-adv-link-color]' , 'color' , '.footer-adv a' ) ;
astra _css ( 'astra-settings[footer-adv-link-h-color]' , 'color' , '.footer-adv a:hover, .footer-adv .no-widget-text a:hover, .footer-adv a:focus, .footer-adv .no-widget-text a:focus' ) ;
// Footer Widget background.
wp . customize ( 'astra-settings[footer-adv-bg-obj]' , function ( value ) {
value . bind ( function ( bg _obj ) {
var dynamicStyle = ' .footer-adv-overlay { {{css}} }' ;
astra _background _obj _css ( wp . customize , bg _obj , 'footer-adv-bg-obj' , dynamicStyle ) ;
} ) ;
} ) ;
/ *
* Woocommerce Shop Archive Custom Width
* /
wp . customize ( 'astra-settings[shop-archive-max-width]' , function ( setting ) {
setting . bind ( function ( width ) {
var dynamicStyle = '@media all and ( min-width: 921px ) {' ;
if ( ! jQuery ( 'body' ) . hasClass ( 'ast-page-builder-template' ) ) {
dynamicStyle += '.ast-woo-shop-archive .site-content > .ast-container{ max-width: ' + ( parseInt ( width ) ) + 'px } ' ;
}
if ( jQuery ( 'body' ) . hasClass ( 'ast-fluid-width-layout' ) ) {
dynamicStyle += '.ast-woo-shop-archive .site-content > .ast-container{ padding-left:20px; padding-right:20px; } ' ;
}
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'shop-archive-max-width' , dynamicStyle ) ;
} ) ;
} ) ;
//[1] Primary Menu Toggle Button Style.
wp . customize ( 'astra-settings[mobile-header-toggle-btn-style]' , function ( setting ) {
setting . bind ( function ( icon _style ) {
var icon _color = wp . customize ( 'astra-settings[mobile-header-toggle-btn-color]' ) . get ( ) ;
if ( '' === icon _color && 'fill' === icon _style ) {
var dynamicStyle = ' [data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg { fill: #ffffff; } ' ;
astra _add _dynamic _css ( 'mobile-header-toggle-btn-style' , dynamicStyle ) ;
} else {
astra _add _dynamic _css ( 'mobile-header-toggle-btn-style' , '' ) ;
}
var buttons = $ ( document ) . find ( '.ast-mobile-menu-buttons .menu-toggle' ) ;
buttons . removeClass ( 'ast-mobile-menu-buttons-default ast-mobile-menu-buttons-fill ast-mobile-menu-buttons-outline' ) ;
buttons . removeClass ( 'ast-mobile-menu-buttons-default ast-mobile-menu-buttons-fill ast-mobile-menu-buttons-minimal' ) ;
buttons . addClass ( 'ast-mobile-menu-buttons-' + icon _style ) ;
var themeColor = wp . customize ( 'astra-settings[theme-color]' ) . get ( ) ;
var defaultColor = '#ffffff' ;
var toggleButtonColor = wp . customize ( 'astra-settings[mobile-header-toggle-btn-color]' ) . get ( ) ;
if ( 'fill' !== icon _style ) {
defaultColor = themeColor
}
var iconColor = defaultColor ;
if ( '' !== toggleButtonColor && undefined !== toggleButtonColor && null !== toggleButtonColor ) {
iconColor = toggleButtonColor
}
var dynamicStyle = '[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg {' ;
dynamicStyle += 'fill: ' + iconColor + ';' ;
dynamicStyle += '}' ;
dynamicStyle += '[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-wrap .mobile-menu {' ;
dynamicStyle += 'color: ' + iconColor + ';' ;
dynamicStyle += '}' ;
dynamicStyle += '[data-section="section-header-mobile-trigger"] .ast-button-wrap .ast-mobile-menu-trigger-fill, [data-section="section-header-mobile-trigger"] .ast-button-wrap .ast-mobile-menu-trigger-minimal {' ;
dynamicStyle += 'color: ' + iconColor + ';' ;
dynamicStyle += 'border: none;' ;
dynamicStyle += '}' ;
dynamicStyle += '[data-section="section-header-mobile-trigger"] .ast-button-wrap .ast-mobile-menu-trigger-outline {' ;
dynamicStyle += 'color: ' + iconColor + ';' ;
dynamicStyle += '}' ;
;
astra _add _dynamic _css ( 'mobile-header-toggle-btn-style' , dynamicStyle ) ;
} ) ;
} ) ;
//[1] Toggle Button Border Radius.
wp . customize ( 'astra-settings[mobile-header-toggle-btn-border-radius]' , function ( setting ) {
setting . bind ( function ( border ) {
var dynamicStyle = '.ast-header-break-point .main-header-bar .ast-button-wrap .menu-toggle { border-radius: ' + ( parseInt ( border ) ) + 'px } ' ;
astra _add _dynamic _css ( 'mobile-header-toggle-btn-border-radius' , dynamicStyle ) ;
} ) ;
} ) ;
/ * *
* Primary Submenu border
* /
wp . customize ( 'astra-settings[primary-submenu-border]' , function ( value ) {
value . bind ( function ( border ) {
var color = wp . customize ( 'astra-settings[primary-submenu-b-color]' ) . get ( ) ;
if ( '' != border . top || '' != border . right || '' != border . bottom || '' != border . left ) {
var dynamicStyle = '.ast-desktop .main-header-menu.submenu-with-border .sub-menu' ;
dynamicStyle += '{' ;
dynamicStyle += 'border-top-width:' + border . top + 'px;' ;
dynamicStyle += 'border-right-width:' + border . right + 'px;' ;
dynamicStyle += 'border-left-width:' + border . left + 'px;' ;
dynamicStyle += 'border-bottom-width:' + border . bottom + 'px;' ;
dynamicStyle += 'border-color:' + color + ';' ;
dynamicStyle += 'border-style: solid;' ;
dynamicStyle += '}' ;
dynamicStyle += '.ast-desktop .main-header-menu.submenu-with-border .sub-menu .sub-menu' ;
dynamicStyle += '{' ;
dynamicStyle += 'top:-' + border . top + 'px;' ;
dynamicStyle += '}' ;
// Submenu items goes outside?
dynamicStyle += '@media (min-width: 769px){' ;
dynamicStyle += '.main-header-menu .sub-menu .menu-item.ast-left-align-sub-menu:hover > .sub-menu, .main-header-menu .sub-menu .menu-item.ast-left-align-sub-menu.focus > .sub-menu' ;
dynamicStyle += '{' ;
dynamicStyle += 'margin-left:-' + ( + border . left + + border . right ) + 'px;' ;
dynamicStyle += '}' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'primary-submenu-border' , dynamicStyle ) ;
} else {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
/ * *
* Primary Submenu border COlor
* /
wp . customize ( 'astra-settings[primary-submenu-b-color]' , function ( value ) {
value . bind ( function ( color ) {
var border = wp . customize ( 'astra-settings[primary-submenu-border]' ) . get ( ) ;
if ( '' != color ) {
if ( '' != border . top || '' != border . right || '' != border . bottom || '' != border . left ) {
var dynamicStyle = '.ast-desktop .main-header-menu.submenu-with-border .sub-menu' ;
dynamicStyle += '{' ;
dynamicStyle += 'border-top-width:' + border . top + 'px;' ;
dynamicStyle += 'border-right-width:' + border . right + 'px;' ;
dynamicStyle += 'border-left-width:' + border . left + 'px;' ;
dynamicStyle += 'border-bottom-width:' + border . bottom + 'px;' ;
dynamicStyle += 'border-color:' + color + ';' ;
dynamicStyle += 'border-style: solid;' ;
dynamicStyle += '}' ;
dynamicStyle += '.ast-desktop .main-header-menu.submenu-with-border .sub-menu .sub-menu' ;
dynamicStyle += '{' ;
dynamicStyle += 'top:-' + border . top + 'px;' ;
dynamicStyle += '}' ;
// Submenu items goes outside?
dynamicStyle += '@media (min-width: 769px){' ;
dynamicStyle += '.main-header-menu .sub-menu .menu-item.ast-left-align-sub-menu:hover > .sub-menu, .main-header-menu .sub-menu .menu-item.ast-left-align-sub-menu.focus > .sub-menu' ;
dynamicStyle += '{' ;
dynamicStyle += 'margin-left:-' + ( + border . left + + border . right ) + 'px;' ;
dynamicStyle += '}' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'primary-submenu-border-color' , dynamicStyle ) ;
}
} else {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
/ * *
* Primary Submenu border COlor
* /
wp . customize ( 'astra-settings[primary-submenu-item-b-color]' , function ( value ) {
value . bind ( function ( color ) {
var insideBorder = wp . customize ( 'astra-settings[primary-submenu-item-border]' ) . get ( ) ;
if ( '' != color ) {
if ( true == insideBorder ) {
var dynamicStyle = '' ;
dynamicStyle += '.ast-desktop .main-header-menu.submenu-with-border .sub-menu .menu-link' ;
dynamicStyle += '{' ;
dynamicStyle += 'border-bottom-width:' + ( ( true === insideBorder ) ? '1px;' : '0px;' ) ;
dynamicStyle += 'border-color:' + color + ';' ;
dynamicStyle += 'border-style: solid;' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'primary-submenu-item-b-color' , dynamicStyle ) ;
}
} else {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
/ * *
* Primary Submenu border COlor
* /
wp . customize ( 'astra-settings[primary-submenu-item-border]' , function ( value ) {
value . bind ( function ( border ) {
var color = wp . customize ( 'astra-settings[primary-submenu-item-b-color]' ) . get ( ) ;
if ( true === border ) {
var dynamicStyle = '.ast-desktop .main-header-menu.submenu-with-border .sub-menu .menu-link' ;
dynamicStyle += '{' ;
dynamicStyle += 'border-bottom-width:' + ( ( true === border ) ? '1px;' : '0px;' ) ;
dynamicStyle += 'border-color:' + color + ';' ;
dynamicStyle += 'border-style: solid;' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'primary-submenu-item-border' , dynamicStyle ) ;
} else {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
astra _css ( 'astra-settings[header-main-rt-section-button-text-color]' , 'color' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ) ;
astra _css ( 'astra-settings[header-main-rt-section-button-back-color]' , 'background-color' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ) ;
astra _css ( 'astra-settings[header-main-rt-section-button-text-h-color]' , 'color' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button:hover' ) ;
astra _css ( 'astra-settings[header-main-rt-section-button-back-h-color]' , 'background-color' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button:hover' ) ;
astra _css ( 'astra-settings[header-main-rt-section-button-border-radius]' , 'border-radius' , '.main-header-bar .ast-container .button-custom-menu-item .ast-custom-button-link .ast-custom-button' , 'px' ) ;
astra _css ( 'astra-settings[header-main-rt-section-button-border-color]' , 'border-color' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ) ;
astra _css ( 'astra-settings[header-main-rt-section-button-border-h-color]' , 'border-color' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button:hover' ) ;
astra _responsive _spacing ( 'astra-settings[header-main-rt-section-button-padding]' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' , 'padding' , [ 'top' , 'right' , 'bottom' , 'left' ] ) ;
// Header custom button - Typography preview stylings.
astra _generate _outside _font _family _css ( 'astra-settings[primary-header-button-font-family]' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ) ;
astra _responsive _font _size ( 'astra-settings[primary-header-button-font-size]' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ) ;
astra _css ( 'astra-settings[primary-header-button-font-weight]' , 'font-weight' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ) ;
astra _css ( 'astra-settings[primary-header-button-line-height]' , 'line-height' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ) ;
astra _css ( 'astra-settings[primary-header-button-text-transform]' , 'text-transform' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ) ;
astra _css ( 'astra-settings[primary-header-button-letter-spacing]' , 'letter-spacing' , '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' , 'px' ) ;
/ * *
* Custom Button border
* /
wp . customize ( 'astra-settings[header-main-rt-section-button-border-size]' , function ( value ) {
value . bind ( function ( border ) {
if ( '' != border . top || '' != border . right || '' != border . bottom || '' != border . left ) {
var dynamicStyle = '.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ;
dynamicStyle += '{' ;
dynamicStyle += 'border-top-width:' + border . top + 'px;' ;
dynamicStyle += 'border-right-width:' + border . right + 'px;' ;
dynamicStyle += 'border-left-width:' + border . left + 'px;' ;
dynamicStyle += 'border-bottom-width:' + border . bottom + 'px;' ;
dynamicStyle += 'border-style: solid;' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'header-main-rt-section-button-border-size' , dynamicStyle ) ;
}
} ) ;
} ) ;
var ele _border _radius _selector = '' ;
var ele _border _width _selector = '' ;
var ele _padding _selector = '' ;
var v4 _2 _2 _btns _styling _hover = '' ;
var v4 _2 _2 _btns _styling _focus = '' ;
if ( astraCustomizer . v4 _2 _2 _core _form _btns _styling && '' != astraCustomizer . v4 _2 _2 _core _form _btns _styling ) {
v4 _2 _2 _btns _styling _hover = ', #comment .submit:hover, .search .search-submit:hover' ;
v4 _2 _2 _btns _styling _focus = ', #comment .submit:focus, .search .search-submit:focus' ;
}
if ( astraCustomizer . page _builder _button _style _css ) {
if ( 'color-typo' == astraCustomizer . elementor _default _color _font _setting || 'color' == astraCustomizer . elementor _default _color _font _setting || 'font' == astraCustomizer . elementor _default _color _font _setting ) {
ele _border _radius _selector = ', .elementor-widget-button .elementor-button.elementor-size-sm, .elementor-widget-button .elementor-button.elementor-size-xs, .elementor-widget-button .elementor-button.elementor-size-md, .elementor-widget-button .elementor-button.elementor-size-lg, .elementor-widget-button .elementor-button.elementor-size-xl, .elementor-widget-button .elementor-button' ;
ele _border _width _selector = ', .elementor-widget-button .elementor-button, .elementor-widget-button .elementor-button:visited' ;
ele _padding _selector = ', .elementor-widget-button .elementor-button.elementor-size-sm, .elementor-widget-button .elementor-button.elementor-size-xs, .elementor-widget-button .elementor-button.elementor-size-md, .elementor-widget-button .elementor-button.elementor-size-lg, .elementor-widget-button .elementor-button.elementor-size-xl, .elementor-widget-button .elementor-button' ;
}
}
/ * *
* Button border
* /
wp . customize ( 'astra-settings[theme-button-border-group-border-size]' , function ( value ) {
value . bind ( function ( border ) {
var search _button _selector = hasWordPressWidgetBlockEditor ( ) ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button, .woocommerce a.button' : '' ;
var dynamicStyle = '.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .wp-block-button .wp-block-button__link' + astraCustomizer . v4 _2 _2 _core _form _btns _styling + ele _border _width _selector + search _button _selector + woo _btn _normal _sector + lifterLMSBtnSelector ;
if ( '' != border . top || '' != border . right || '' != border . bottom || '' != border . left ) {
if ( astraCustomizer . gb _outline _buttons _patterns _support && ! astraCustomizer . updated _gb _outline _button _patterns ) {
wp . customize . preview . send ( 'refresh' ) ;
} else {
dynamicStyle += '{' ;
dynamicStyle += 'border-top-width:' + border . top + 'px;' ;
dynamicStyle += 'border-right-width:' + border . right + 'px;' ;
dynamicStyle += 'border-left-width:' + border . left + 'px;' ;
dynamicStyle += 'border-bottom-width:' + border . bottom + 'px;' ;
dynamicStyle += 'border-style: solid;' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'theme-button-border-group-border-size' , dynamicStyle ) ;
}
} else {
if ( astraCustomizer . gb _outline _buttons _patterns _support && ! astraCustomizer . updated _gb _outline _button _patterns ) {
wp . customize . preview . send ( 'refresh' ) ;
} else {
dynamicStyle += '{' ;
dynamicStyle += 'border-top-width: 0;' ;
dynamicStyle += 'border-right-width: 0;' ;
dynamicStyle += 'border-left-width: 0;' ;
dynamicStyle += 'border-bottom-width: 0;' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'theme-button-border-group-border-size' , dynamicStyle ) ;
}
}
} ) ;
} ) ;
wp . customize ( 'astra-settings[secondary-theme-button-border-group-border-size]' , function ( value ) {
value . bind ( function ( border ) {
var dynamicStyle = '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link.wp-element-button, .ast-outline-button, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button' ;
if ( '' != border . top || '' != border . right || '' != border . bottom || '' != border . left ) {
if ( astraCustomizer . gb _outline _buttons _patterns _support && ! astraCustomizer . updated _gb _outline _button _patterns ) {
wp . customize . preview . send ( 'refresh' ) ;
} else {
dynamicStyle += '{' ;
dynamicStyle += 'border-top-width:' + border . top + 'px;' ;
dynamicStyle += 'border-right-width:' + border . right + 'px;' ;
dynamicStyle += 'border-left-width:' + border . left + 'px;' ;
dynamicStyle += 'border-bottom-width:' + border . bottom + 'px;' ;
dynamicStyle += 'border-style: solid;' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'secondary-theme-button-border-group-border-size' , dynamicStyle ) ;
}
} else {
if ( astraCustomizer . gb _outline _buttons _patterns _support && ! astraCustomizer . updated _gb _outline _button _patterns ) {
wp . customize . preview . send ( 'refresh' ) ;
} else {
dynamicStyle += '{' ;
dynamicStyle += 'border-top-width: 0;' ;
dynamicStyle += 'border-right-width: 0;' ;
dynamicStyle += 'border-left-width: 0;' ;
dynamicStyle += 'border-bottom-width: 0;' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'secondary-theme-button-border-group-border-size' , dynamicStyle ) ;
}
}
} ) ;
} ) ;
var search _button _selector = hasWordPressWidgetBlockEditor ( ) ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button' : '' ;
// Primary button padding.
astra _responsive _spacing ( 'astra-settings[theme-button-padding]' , '.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .woocommerce a.button, .woocommerce button.button, .woocommerce .product a.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce input.button:disabled, .woocommerce input.button:disabled[disabled], .wp-block-button .wp-block-button__link' + astraCustomizer . v4 _2 _2 _core _form _btns _styling + ele _padding _selector + search _button _selector + lifterLMSBtnSelector , 'padding' , [ 'top' , 'bottom' ] ) ;
astra _responsive _spacing ( 'astra-settings[theme-button-padding]' , '.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .woocommerce a.button, .woocommerce button.button, .woocommerce .product a.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce input.button:disabled, .woocommerce input.button:disabled[disabled], .wp-block-button .wp-block-button__link' + astraCustomizer . v4 _2 _2 _core _form _btns _styling + ele _padding _selector + search _button _selector + lifterLMSBtnSelector , 'padding' , [ 'left' , 'right' ] ) ;
// Secondary button padding.
astra _responsive _spacing ( 'astra-settings[secondary-theme-button-padding]' , '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link.wp-element-button, .ast-outline-button, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button' , 'padding' , [ 'top' , 'bottom' ] ) ;
astra _responsive _spacing ( 'astra-settings[secondary-theme-button-padding]' , '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link.wp-element-button, .ast-outline-button, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button' , 'padding' , [ 'left' , 'right' ] ) ;
/ * *
* Button border
* /
wp . customize ( 'astra-settings[transparent-header-button-border-group]' , function ( value ) {
value . bind ( function ( value ) {
var optionValue = JSON . parse ( value ) ;
var border = optionValue [ 'header-main-rt-trans-section-button-border-size' ] ;
if ( '' != border . top || '' != border . right || '' != border . bottom || '' != border . left ) {
var dynamicStyle = '.ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' ;
dynamicStyle += '{' ;
dynamicStyle += 'border-top-width:' + border . top + 'px;' ;
dynamicStyle += 'border-right-width:' + border . right + 'px;' ;
dynamicStyle += 'border-left-width:' + border . left + 'px;' ;
dynamicStyle += 'border-bottom-width:' + border . bottom + 'px;' ;
dynamicStyle += 'border-style: solid;' ;
dynamicStyle += '}' ;
astra _add _dynamic _css ( 'header-main-rt-trans-section-button-border-size' , dynamicStyle ) ;
}
} ) ;
} ) ;
// Site Title - Font family
astra _generate _outside _font _family _css ( 'astra-settings[font-family-site-title]' , '.site-title, .site-title a' ) ;
// Site Title - Font Weight
astra _generate _font _weight _css ( 'astra-settings[font-family-site-title]' , 'astra-settings[font-weight-site-title]' , 'font-weight' , '.site-title, .site-title a' ) ;
// Site Title - Font Size
astra _responsive _font _size ( 'astra-settings[font-size-site-title]' , '.site-title, .site-title a' ) ;
astra _font _extras _css ( 'font-extras-site-title' , '.site-title, .site-title a' ) ;
// Site tagline - Font family
astra _generate _outside _font _family _css ( 'astra-settings[font-family-site-tagline]' , '.ast-sg-logo-section .site-description, .site-header .site-description' ) ;
// Site Tagline - Font Weight
astra _generate _font _weight _css ( 'astra-settings[font-family-site-tagline]' , 'astra-settings[font-weight-site-tagline]' , 'font-weight' , '.ast-sg-logo-section .site-description, .site-header .site-description' ) ;
// Site Tagline - Font Size
astra _responsive _font _size ( 'astra-settings[font-size-site-tagline]' , '.ast-sg-logo-section .site-description, .site-header .site-description' ) ;
// Site Tagline - Line Height
astra _css ( 'astra-settings[line-height-site-tagline]' , 'line-height' , '.ast-sg-logo-section .site-description, .site-header .site-description' ) ;
// Site Tagline - Text Transform
astra _css ( 'astra-settings[text-transform-site-tagline]' , 'text-transform' , '.ast-sg-logo-section .site-description, .site-header .site-description' ) ;
search _button _selector = hasWordPressWidgetBlockEditor ( ) ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button, .woocommerce a.button' : woo _btn _normal _sector ;
var search _button _hover _selector = hasWordPressWidgetBlockEditor ( ) ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:focus, .woocommerce a.button:hover' : woo _btn _hover _sector ;
//Compatibility with wordpress 6.1.1
const global _builder _btn = '.wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color), .wp-block-buttons .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color)' ;
const global _builder _btn _hover = ', .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link:focus, .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color):hover, .wp-block-buttons .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color):hover' ;
if ( astraCustomizer . page _builder _button _style _css ) {
var btn _color _ele = '' ;
var btn _bg _color _ele = '' ;
var btn _h _color _ele = '' ;
var btn _bg _h _color _ele = '' ;
var btn _border _color _ele = '' ;
var btn _border _h _color _ele = '' ;
if ( 'color-typo' == astraCustomizer . elementor _default _color _font _setting || 'color' == astraCustomizer . elementor _default _color _font _setting ) {
// Theme Button - Text Color
btn _color _ele = ',.elementor-widget-button .elementor-button, .elementor-widget-button .elementor-button:visited' ;
// Theme Button - Background Color
btn _bg _color _ele = ',.elementor-widget-button .elementor-button, .elementor-widget-button .elementor-button:visited' ;
// Theme Button - Text Hover Color
btn _h _color _ele = ',.elementor-widget-button .elementor-button:hover, .elementor-widget-button .elementor-button:focus' ;
// Theme Button - Background Hover Color
btn _bg _h _color _ele = ',.elementor-widget-button .elementor-button:hover, .elementor-widget-button .elementor-button:focus' ;
// Theme Button - Border Color
btn _border _color _ele = ', .elementor-widget-button .elementor-button, .elementor-widget-button .elementor-button:visited' ;
// Theme Button - Border Hover Color
btn _border _h _color _ele = ',.elementor-widget-button .elementor-button:hover, .elementor-widget-button .elementor-button:focus' ;
}
var btnSelector = '.menu-toggle, button, .ast-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .wp-block-button:not(.is-style-outline) .wp-block-button__link, .ast-custom-button' + astraCustomizer . v4 _2 _2 _core _form _btns _styling + btn _bg _color _ele + search _button _selector + woo _btn _normal _sector + lifterLMSBtnSelector ;
// Secondary button selectors.
var btnSecondarySelector = '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link.wp-element-button, .ast-outline-button, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button' ;
var btnSecondaryColorSelector = '.wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button:not(.has-text-color), .wp-block-buttons .wp-block-button.wp-block-button__link.wp-element-button.is-style-outline:not(.has-text-color), .ast-outline-button, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button' ;
astraHandleButtonPresetPreview ( btnSelector ) ;
// Theme Button - Text Hover Color
astra _css ( 'astra-settings[button-h-color]' , 'color' , 'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus, .wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus, .ast-custom-button:hover, .ast-custom-button:focus, .wp-block-button .uagb-buttons-repeater.wp-block-button__link:hover' + v4 _2 _2 _btns _styling _hover + btn _h _color _ele + search _button _hover _selector + global _builder _btn _hover + lifterLMSBtnHSelector , '' , true ) ;
// Theme Secondary Button - Text Hover Color
astra _css ( 'astra-settings[secondary-button-h-color]' , 'color' , '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link:focus, .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color):hover, .wp-block-buttons .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color):hover, .ast-outline:hover, .ast-outline:focus, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button:hover' , '' , true ) ;
// Theme Button - Background Hover Color
astra _css ( 'astra-settings[button-bg-h-color]' , 'background-color' , 'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus, .wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus, .ast-custom-button:hover, .ast-custom-button:focus, .wp-block-button .uagb-buttons-repeater.wp-block-button__link:hover' + v4 _2 _2 _btns _styling _hover + btn _bg _h _color _ele + search _button _hover _selector + global _builder _btn _hover + woo _btn _hover _sector + lifterLMSBtnHSelector ) ;
// Theme Secondary Button - Background Hover Color
astra _css ( 'astra-settings[secondary-button-bg-h-color]' , 'background-color' , '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link:focus, .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color):hover, .wp-block-buttons .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color):hover, .ast-outline-button:hover, .ast-outline-button:focus, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button:hover' ) ;
astra _css ( 'astra-settings[theme-button-border-group-border-color]' , 'border-color' , '.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .wp-block-button .wp-block-button__link' + astraCustomizer . v4 _2 _2 _core _form _btns _styling + btn _border _color _ele + search _button _selector + ', ' + global _builder _btn + woo _btn _normal _sector + lifterLMSBtnSelector ) ;
// Theme Secondary Button - Border Color
astra _css ( 'astra-settings[secondary-theme-button-border-group-border-color]' , 'border-color' , '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link.wp-element-button, .ast-outline-button, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button' ) ;
// Theme Button - Border Hover Color
astra _css ( 'astra-settings[theme-button-border-group-border-h-color]' , 'border-color' , 'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .ast-custom-button:hover, .button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus, .wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' + v4 _2 _2 _btns _styling _hover + v4 _2 _2 _btns _styling _focus + btn _border _h _color _ele + search _button _hover _selector + global _builder _btn _hover + woo _btn _hover _sector + lifterLMSBtnHSelector ) ;
// Theme Secondary Button - Border Hover Color
astra _css ( 'astra-settings[secondary-theme-button-border-group-border-h-color]' , 'border-color' , '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link:focus, .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color):hover, .wp-block-buttons .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color):hover, .ast-outline-button:hover, .ast-outline-button:focus, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button:hover' ) ;
} else {
var btnSelector = '.menu-toggle, button, .ast-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .ast-custom-button' + search _button _selector + woo _btn _normal _sector + lifterLMSBtnSelector ;
astraHandleButtonPresetPreview ( btnSelector ) ;
// Theme Button - Border Color
astra _css ( 'astra-settings[button-bg-color]' , 'border-color' , '.menu-toggle, button, .ast-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .ast-custom-button' + search _button _selector + lifterLMSBtnSelector ) ;
// Theme Button - Text Hover Color
astra _css ( 'astra-settings[button-h-color]' , 'color' , 'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus, .ast-custom-button:hover, .ast-custom-button:focus' + search _button _hover _selector + lifterLMSBtnHSelector ) ;
// Theme Button - Background Hover Color
astra _css ( 'astra-settings[button-bg-h-color]' , 'background-color' , 'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus, .ast-custom-button:hover, .ast-custom-button:focus' + search _button _hover _selector + lifterLMSBtnHSelector ) ;
astra _responsive _spacing ( 'astra-settings[theme-button-padding]' , '.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .woocommerce a.button, .woocommerce button.button, .woocommerce .product a.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce input.button:disabled, .woocommerce input.button:disabled[disabled]' + astraCustomizer . v4 _2 _2 _core _form _btns _styling + search _button _selector + lifterLMSBtnSelector , 'padding' , [ 'top' , 'bottom' ] ) ;
astra _responsive _spacing ( 'astra-settings[theme-button-padding]' , '.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"], .woocommerce a.button, .woocommerce button.button, .woocommerce .product a.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce input.button:disabled, .woocommerce input.button:disabled[disabled]' + astraCustomizer . v4 _2 _2 _core _form _btns _styling + search _button _selector + lifterLMSBtnSelector , 'padding' , [ 'left' , 'right' ] ) ;
}
// Global custom event which triggers when partial refresh occurs.
wp . customize . bind ( 'preview-ready' , function ( ) {
wp . customize . selectiveRefresh . bind ( 'render-partials-response' , function ( response ) {
if ( response . contents . hasOwnProperty ( 'astra-settings[footer-desktop-items]' )
|| ( ! ( response . contents . hasOwnProperty ( 'astra-settings[header-desktop-items]' )
|| response . contents . hasOwnProperty ( 'astra-settings[header-mobile-items]' ) ) ) ) {
return false ;
}
setTimeout ( function ( ) {
document . dispatchEvent ( new CustomEvent ( "astLayoutWidthChanged" , { "detail" : { 'response' : response } } ) ) ;
} , 10 ) ;
} ) ;
wp . customize . selectiveRefresh . bind ( 'partial-content-rendered' , function ( response ) {
if ( response . partial . id . includes ( "footer" ) ) {
return false ;
}
sessionStorage . setItem ( 'astPartialContentRendered' , true ) ;
document . dispatchEvent ( new CustomEvent ( "astPartialContentRendered" , { "detail" : { 'response' : response } } ) ) ;
} ) ;
wp . customize . selectiveRefresh . bind ( 'partial-content-rendered' , function ( response ) {
wp . customize . preview . send ( 'AstraBuilderPartialContentRendered' , response ) ;
} ) ;
wp . customize . preview . bind ( 'astPreviewDeviceChanged' , function ( device ) {
document . dispatchEvent ( new CustomEvent ( "astPreviewDeviceChanged" , { "detail" : device } ) ) ;
} ) ;
} )
/ * *
* Related Posts Query Arguments - Customizer preview support .
* /
wp . customize ( 'astra-settings[related-posts-based-on]' , function ( setting ) {
setting . bind ( function ( ) {
wp . customize . preview . send ( 'refresh' ) ;
} ) ;
} ) ;
wp . customize ( 'astra-settings[related-posts-order-by]' , function ( setting ) {
setting . bind ( function ( ) {
wp . customize . preview . send ( 'refresh' ) ;
} ) ;
} ) ;
wp . customize ( 'astra-settings[related-posts-order]' , function ( setting ) {
setting . bind ( function ( ) {
wp . customize . preview . send ( 'refresh' ) ;
} ) ;
} ) ;
/ * *
* Related Posts color stylings .
* /
astra _css ( 'astra-settings[related-posts-text-color]' , 'color' , '.ast-related-post-content .entry-header .ast-related-post-title a, .ast-related-post-content .ast-related-post-excerpt' ) ;
astra _css ( 'astra-settings[related-posts-meta-color]' , 'color' , '.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' ) ;
astra _css ( 'astra-settings[related-posts-title-color]' , 'color' , '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ) ;
astra _css ( 'astra-settings[related-posts-background-color]' , 'background-color' , '.ast-single-related-posts-container' ) ;
astra _css ( 'astra-settings[related-posts-link-color]' , 'color' , '.ast-related-post-content .ast-related-post-cta a' ) ;
astra _css ( 'astra-settings[related-posts-link-hover-color]' , 'color' , '.ast-related-post-content .ast-related-post-cta a:hover' ) ;
astra _css ( 'astra-settings[related-posts-meta-link-hover-color]' , 'color' , '.ast-related-post-content .entry-meta a:hover, .ast-related-post-content .entry-meta span a span:hover' ) ;
// Related Posts - Customizer preview for Post Title.
astra _generate _outside _font _family _css ( 'astra-settings[related-posts-title-font-family]' , '.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' ) ;
astra _css ( 'astra-settings[related-posts-title-font-weight]' , 'font-weight' , '.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' ) ;
astra _responsive _font _size ( 'astra-settings[related-posts-title-font-size]' , '.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' ) ;
astra _font _extras _css ( 'related-posts-title-font-extras' , '.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' ) ;
// Related Posts - Customizer preview for Section Title.
astra _generate _outside _font _family _css ( 'astra-settings[related-posts-section-title-font-family]' , '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ) ;
astra _css ( 'astra-settings[related-posts-section-title-font-weight]' , 'font-weight' , '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ) ;
astra _responsive _font _size ( 'astra-settings[related-posts-section-title-font-size]' , '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ) ;
astra _css ( 'astra-settings[releted-posts-title-alignment]' , 'text-align' , '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ) ;
astra _font _extras _css ( 'related-posts-section-title-font-extras' , '.ast-single-related-posts-container .ast-related-posts-title-section .ast-related-posts-title' ) ;
// Related Posts - Customizer preview for Post Meta.
astra _generate _outside _font _family _css ( 'astra-settings[related-posts-meta-font-family]' , '.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' ) ;
astra _css ( 'astra-settings[related-posts-meta-font-weight]' , 'font-weight' , '.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' ) ;
astra _responsive _font _size ( 'astra-settings[related-posts-meta-font-size]' , '.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' ) ;
astra _font _extras _css ( 'related-posts-meta-font-extras' , '.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' ) ;
// Related Posts - Customizer preview for Post Content.
astra _generate _outside _font _family _css ( 'astra-settings[related-posts-content-font-family]' , '.ast-related-post-content .ast-related-post-excerpt' ) ;
astra _css ( 'astra-settings[related-posts-content-font-weight]' , 'font-weight' , '.ast-related-post-content .ast-related-post-excerpt' ) ;
astra _responsive _font _size ( 'astra-settings[related-posts-content-font-size]' , '.ast-related-post-content .ast-related-post-excerpt' ) ;
astra _font _extras _css ( 'related-posts-content-font-extras' , '.ast-related-post-content .ast-related-post-excerpt' ) ;
astra _border _spacing _advanced _css ( 'ast-sub-section-related-posts' , 'body .site .ast-single-related-posts-container' ) ;
astra _border _spacing _advanced _css ( 'ast-sub-section-comments' , 'body .site .comments-area' ) ;
// Title Color.
astra _css (
'astra-settings[header-color-site-title]' ,
'color' ,
'.ast-site-identity .site-title a, .ast-site-identity .site-title'
) ;
// Title Hover Color.
astra _css (
'astra-settings[header-color-h-site-title]' ,
'color' ,
'.ast-site-identity .site-title a:hover, .ast-site-identity .site-title:hover'
) ;
// Logo SVG Icon Color.
astra _css (
'astra-settings[logo-svg-icon-color]' ,
'fill' ,
'.site-branding .ast-logo-svg-icon svg'
) ;
// Logo SVG Icon Hover Color.
astra _css (
'astra-settings[logo-svg-icon-hover-color]' ,
'fill' ,
'.site-branding .ast-logo-svg-icon:hover svg'
) ;
// Tagline Color.
astra _css (
'astra-settings[header-color-site-tagline]' ,
'color' ,
'.ast-site-identity .site-description'
) ;
wp . customize ( 'astra-settings[related-posts-author-avatar-size]' , function ( value ) {
value . bind ( function ( size ) {
var dynamicStyle = '' ;
dynamicStyle += '.ast-related-post-content .ast-author-avatar img {' ;
dynamicStyle += 'width: ' + size + 'px;' ;
dynamicStyle += 'height: ' + size + 'px;' ;
dynamicStyle += '} ' ;
astra _add _dynamic _css ( 'related-posts-author-avatar-size' , dynamicStyle ) ;
} ) ;
} ) ;
astra _generate _outside _font _family _css ( 'astra-settings[body-font-family]' , 'body, button, input, select, textarea, .ast-button, .ast-custom-button' ) ;
astra _generate _font _weight _css ( 'astra-settings[body-font-family]' , 'astra-settings[body-font-weight]' , 'font-weight' , 'body, button, input, select, textarea, .ast-button, .ast-custom-button' ) ;
astra _font _extras _css ( 'body-font-extras' , 'body, button, input, select, textarea, .ast-button, .ast-custom-button' ) ;
wp . customize ( 'astra-settings[font-size-body]' , function ( value ) {
value . bind ( function ( value ) {
if ( value . desktop || value . mobile || value . tablet ) {
var fontSize = '' ,
control = 'astra-settings[font-size-body]' ,
selector = 'body, button, input, select, textarea, .ast-button, .ast-custom-button' ,
tabletFontSize = '' ,
mobileFontSize = '' ,
css _property = 'font-size' ,
tablet _break _point = 768 ,
mobile _break _point = 544 ;
// Remove <style> first!
control = control . replace ( '[' , '-' ) ;
control = control . replace ( ']' , '' ) ;
jQuery ( 'style#' + control + '-' + css _property ) . remove ( ) ;
if ( '' != value . desktop ) {
fontSize = 'font-size: ' + value . desktop + ( undefined == value [ 'desktop-unit' ] ? 'px' : value [ 'desktop-unit' ] ) ;
}
if ( '' != value . tablet ) {
tabletFontSize = 'font-size: ' + value . tablet + ( undefined == value [ 'tablet-unit' ] ? 'px' : value [ 'tablet-unit' ] ) ;
}
if ( '' != value . mobile ) {
mobileFontSize = 'font-size: ' + value . mobile + ( undefined == value [ 'mobile-unit' ] ? 'px' : value [ 'mobile-unit' ] ) ;
}
// Concat and append new <style>.
jQuery ( 'head' ) . append (
'<style id="' + control + '-' + css _property + '">'
+ selector + ' { ' + fontSize + ' }'
+ '@media (max-width: ' + tablet _break _point + 'px) {.ast-header-break-point ' + selector + ' { ' + tabletFontSize + ' } }'
+ '@media (max-width: ' + mobile _break _point + 'px) {.ast-header-break-point ' + selector + ' { ' + mobileFontSize + ' } }'
+ '</style>'
) ;
} else {
jQuery ( 'style#' + control + '-font-size' ) . remove ( ) ;
}
} ) ;
} ) ;
astra _refresh _customizer ( 'astra-settings[related-metadata-separator]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-image-ratio-type]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-image-ratio-pre-scale]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-image-custom-scale-width]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-image-custom-scale-height]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-image-size]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-author-prefix-label]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-author-avatar]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-meta-date-type]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-date-format]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-category-style]' ) ;
astra _refresh _customizer ( 'astra-settings[related-posts-tag-style]' ) ;
function astraHandleButtonPresetPreview ( btnSelector ) {
wp . customize ( 'astra-settings[button-preset-style]' , function ( setting ) {
setting . bind ( function ( value ) {
var buttonBGColor = wp . customize ( 'astra-settings[button-bg-color]' ) . get ( ) ;
var buttonTextColor = wp . customize ( 'astra-settings[button-color]' ) . get ( ) ;
var themeColor = wp . customize ( 'astra-settings[theme-color]' ) . get ( ) ;
if ( 'button_04' === value || 'button_05' === value || 'button_06' === value ) {
var buttonBorderColor = wp . customize ( 'astra-settings[theme-button-border-group-border-color]' ) . get ( ) ;
if ( '' === buttonBorderColor ) {
jQuery ( 'style#astra-settings-theme-button-border-group-border-color' ) . remove ( ) ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-theme-button-border-group-border-color">'
+ btnSelector + ' { border-color: ' + buttonBGColor + ' }'
+ '</style>'
) ;
}
if ( '' === buttonTextColor && '' !== buttonBGColor ) {
jQuery ( 'style#astra-settings-button-outline-preset-color' ) . remove ( ) ;
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-outline-preset-color">'
+ btnSelector + ' { color: ' + buttonBGColor + ' }'
+ '</style>'
) ;
}
if ( '' === buttonTextColor && '' === buttonBGColor ) {
jQuery ( 'style#astra-settings-button-outline-preset-color' ) . remove ( ) ;
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-outline-preset-color">'
+ btnSelector + ' { color: ' + themeColor + ' }'
+ '</style>'
) ;
}
// Remove old.
jQuery ( 'style#astra-settings-button-preset-style-background-color' ) . remove ( ) ;
// Concat and append new <style>.
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-preset-style-background-color">'
+ btnSelector + ' { background: transparent }'
+ '</style>'
) ;
}
else {
jQuery ( 'style#astra-settings-button-bg-color-background-color' ) . remove ( ) ;
jQuery ( 'style#astra-settings-button-outline-preset-color' ) . remove ( ) ;
if ( '' === buttonTextColor && '' === buttonBGColor ) {
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-bg-color-background-color">'
+ btnSelector + ' { background-color: ' + themeColor + ' }'
+ '</style>'
) ;
} else {
// Set background color for button to theme color when value is empty.
buttonBGColor = ( '' != buttonBGColor ) ? buttonBGColor : themeColor ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-bg-color-background-color">'
+ btnSelector + ' { background-color: ' + buttonBGColor + ' }'
+ '</style>'
) ;
}
if ( '' === buttonTextColor ) {
// Set button text color to white when value is empty.
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-outline-preset-color">'
+ btnSelector + ' { color: #FFFFFF; }'
+ '</style>'
) ;
jQuery ( 'style#astra-settings-button-color-color' ) . remove ( ) ;
}
}
} ) ;
} ) ;
wp . customize ( 'astra-settings[secondary-button-preset-style]' , function ( setting ) {
var btnBgColorSelector = '.wp-block-buttons .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background), .wp-block-buttons .wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background), .ast-outline-button' ;
setting . bind ( function ( value ) {
var buttonBGColor = wp . customize ( 'astra-settings[secondary-button-bg-color]' ) . get ( ) ;
var buttonTextColor = wp . customize ( 'astra-settings[secondary-button-color]' ) . get ( ) ;
var themeColor = wp . customize ( 'astra-settings[theme-color]' ) . get ( ) ;
if ( 'button_04' === value || 'button_05' === value || 'button_06' === value ) {
var buttonBorderColor = wp . customize ( 'astra-settings[secondary-theme-button-border-group-border-color]' ) . get ( ) ;
if ( '' === buttonBorderColor ) {
jQuery ( 'style#astra-settings-secondary-theme-button-border-group-border-color' ) . remove ( ) ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-theme-button-border-group-border-color">'
+ btnSecondarySelector + ' { border-color: ' + buttonBGColor + ' }'
+ '</style>'
) ;
}
if ( '' === buttonTextColor && '' !== buttonBGColor ) {
jQuery ( 'style#astra-settings-secondary-button-outline-preset-color' ) . remove ( ) ;
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-outline-preset-color">'
+ btnSecondaryColorSelector + ' { color: ' + buttonBGColor + ' }'
+ '</style>'
) ;
}
if ( '' === buttonTextColor && '' === buttonBGColor ) {
jQuery ( 'style#astra-settings-secondary-button-outline-preset-color' ) . remove ( ) ;
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-outline-preset-color">'
+ btnSecondaryColorSelector + ' { color: ' + themeColor + ' }'
+ '</style>'
) ;
}
// Remove old.
jQuery ( 'style#astra-settings-secondary-button-preset-style-background-color' ) . remove ( ) ;
// Concat and append new <style>.
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-preset-style-background-color">'
+ btnBgColorSelector + ' { background: transparent }'
+ '</style>'
) ;
} else {
jQuery ( 'style#astra-settings-secondary-button-bg-color-background-color' ) . remove ( ) ;
jQuery ( 'style#astra-settings-secondary-button-outline-preset-color' ) . remove ( ) ;
if ( '' === buttonTextColor && '' === buttonBGColor ) {
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-bg-color-background-color">'
+ btnBgColorSelector + ' { background-color: ' + themeColor + ' }'
+ '</style>'
) ;
} else {
// Set background color for button to theme color when value is empty.
buttonBGColor = ( '' != buttonBGColor ) ? buttonBGColor : themeColor ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-bg-color-background-color">'
+ btnBgColorSelector + ' { background-color: ' + buttonBGColor + ' }'
+ '</style>'
) ;
}
if ( '' === buttonTextColor ) {
// Set button text color to white when value is empty.
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-outline-preset-color">'
+ btnSecondaryColorSelector + ' { color: #FFFFFF; }'
+ '</style>'
) ;
jQuery ( 'style#astra-settings-secondary-button-color-color' ) . remove ( ) ;
}
// Clear preset.
if ( '' === value ) {
wp . customize . preview . send ( 'refresh' ) ;
}
}
} ) ;
} ) ;
wp . customize ( 'astra-settings[button-color]' , function ( setting ) {
setting . bind ( function ( value ) {
if ( '' === value ) {
var buttonPreset = wp . customize ( 'astra-settings[button-preset-style]' ) . get ( ) ;
// If button has outline preset.
if ( 'button_04' === buttonPreset || 'button_05' === buttonPreset || 'button_06' === buttonPreset ) {
var buttonBGColor = wp . customize ( 'astra-settings[button-bg-color]' ) . get ( ) ;
jQuery ( 'style#astra-settings-button-outline-color' ) . remove ( ) ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-color-color">'
+ btnSelector + ' { color: ' + buttonBGColor + ' }'
+ '</style>'
) ;
}
else {
jQuery ( 'style#astra-settings-button-color-color' ) . remove ( ) ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-color-color">'
+ btnSelector + ' { color: #FFFFFF }'
+ '</style>'
) ;
}
} else {
jQuery ( 'style#astra-settings-button-color-color' ) . remove ( ) ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-color-color">'
+ btnSelector + ' { color: ' + value + ' }'
+ '</style>'
) ;
}
} ) ;
} ) ;
wp . customize ( 'astra-settings[secondary-button-color]' , function ( setting ) {
setting . bind ( function ( value ) {
if ( '' === value ) {
var buttonPreset = wp . customize ( 'astra-settings[secondary-button-preset-style]' ) . get ( ) ;
var themeColor = wp . customize ( 'astra-settings[theme-color]' ) . get ( ) ;
// If button has outline preset.
if ( 'button_04' === buttonPreset || 'button_05' === buttonPreset || 'button_06' === buttonPreset ) {
var buttonBGColor = wp . customize ( 'astra-settings[secondary-button-bg-color]' ) . get ( ) ;
jQuery ( 'style#astra-settings-secondary-button-color-color' ) . remove ( ) ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-color-color">'
+ btnSecondaryColorSelector + ' { color: ' + buttonBGColor + ' }'
+ '</style>'
) ;
} else {
jQuery ( 'style#astra-settings-button-color-color' ) . remove ( ) ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-color-color">'
+ btnSecondaryColorSelector + ' { color: ' + themeColor + ' }'
+ '</style>'
) ;
}
} else {
jQuery ( 'style#astra-settings-secondary-button-color-color' ) . remove ( ) ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-color-color">'
+ btnSecondaryColorSelector + ' { color: ' + value + ' }'
+ '</style>'
) ;
}
} ) ;
} ) ;
wp . customize ( 'astra-settings[button-bg-color]' , function ( setting ) {
setting . bind ( function ( value ) {
var buttonPreset = wp . customize ( 'astra-settings[button-preset-style]' ) . get ( ) ;
var themeColor = wp . customize ( 'astra-settings[theme-color]' ) . get ( ) ;
var buttonTextColor = wp . customize ( 'astra-settings[button-color]' ) . get ( ) ;
// If button has outline preset.
if ( 'button_04' === buttonPreset || 'button_05' === buttonPreset || 'button_06' === buttonPreset ) {
var buttonTextColor = wp . customize ( 'astra-settings[button-color]' ) . get ( ) ;
var buttonBorderColor = wp . customize ( 'astra-settings[theme-button-border-group-border-color]' ) . get ( ) ;
if ( '' === buttonBorderColor ) {
// Theme Button - Background Color
jQuery ( 'style#astra-settings-theme-button-border-group-border-color' ) . remove ( ) ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-theme-button-border-group-border-color">'
+ btnSelector + ' { border-color: ' + value + ' }'
+ '</style>'
) ;
}
if ( '' === buttonTextColor ) {
jQuery ( 'style#astra-settings-button-outline-preset-color' ) . remove ( ) ;
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-outline-preset-color">'
+ btnSelector + ' { color: ' + value + ' }'
+ '</style>'
) ;
}
}
else {
jQuery ( 'style#astra-settings-button-bg-color-background-color' ) . remove ( ) ;
jQuery ( 'style#astra-settings-button-outline-preset-color' ) . remove ( ) ;
// Set background color for button to theme color when value is empty.
value = ( '' != value ) ? value : themeColor ;
if ( '' === buttonTextColor ) {
jQuery ( 'head' ) . append (
'<style id="astra-settings-button-outline-preset-color">'
+ btnSelector + ' { color: #FFFFFF; }'
+ '</style>'
) ;
}
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="stra-settings-button-bg-color-background-color">'
+ btnSelector + ' { background-color: ' + value + ' }'
+ '</style>'
) ;
}
} ) ;
} ) ;
wp . customize ( 'astra-settings[secondary-button-bg-color]' , function ( setting ) {
var btnBgColorSelector = '.wp-block-buttons .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background), .wp-block-buttons .wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background), .ast-outline-button' ;
setting . bind ( function ( value ) {
var buttonPreset = wp . customize ( 'astra-settings[secondary-button-preset-style]' ) . get ( ) ;
var themeColor = wp . customize ( 'astra-settings[theme-color]' ) . get ( ) ;
var buttonTextColor = wp . customize ( 'astra-settings[secondary-button-color]' ) . get ( ) ;
var buttonBorderColor = wp . customize ( 'astra-settings[secondary-theme-button-border-group-border-color]' ) . get ( ) ;
// If button has outline preset.
if ( 'button_04' === buttonPreset || 'button_05' === buttonPreset || 'button_06' === buttonPreset ) {
if ( '' === buttonBorderColor ) {
// Theme Button - Background Color
jQuery ( 'style#astra-settings-secondary-theme-button-border-group-border-color' ) . remove ( ) ;
// Theme Button - Background Color
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-theme-button-border-group-border-color">'
+ btnSecondarySelector + ' { border-color: ' + value + ' }'
+ '</style>'
) ;
}
if ( '' === buttonTextColor ) {
jQuery ( 'style#astra-settings-secondary-button-outline-preset-color' ) . remove ( ) ;
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-outline-preset-color">'
+ btnSecondaryColorSelector + ' { color: ' + value + ' }'
+ '</style>'
) ;
}
jQuery ( 'style#astra-settings-secondary-button-bg-color-background-color' ) . remove ( ) ;
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-bg-color-background-color">'
+ btnSecondarySelector + ' { background-color: transparent }'
+ '</style>'
) ;
} else if ( 'button_01' === buttonPreset || 'button_02' === buttonPreset || 'button_03' === buttonPreset ) {
jQuery ( 'style#astra-settings-secondary-button-outline-preset-color' ) . remove ( ) ;
jQuery ( 'style#astra-settings-secondary-button-bg-color-background-color' ) . remove ( ) ;
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-bg-color-background-color">'
+ btnSecondarySelector + ' { background-color: ' + value + ' }'
+ '</style>'
) ;
// Set background color for button to theme color when value is empty.
value = ( '' != value ) ? value : themeColor ;
if ( '' === buttonTextColor ) {
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-outline-preset-color">'
+ btnSecondaryColorSelector + ' { color: #FFFFFF; }'
+ '</style>'
) ;
}
} else {
if ( '' === buttonBorderColor ) {
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-theme-button-border-group-border-color">'
+ btnSecondarySelector + ' { border-color: ' + value + ' }'
+ '</style>'
) ;
}
jQuery ( 'style#astra-settings-secondary-button-bg-color-background-color' ) . remove ( ) ;
jQuery ( 'head' ) . append (
'<style id="astra-settings-secondary-button-bg-color-background-color">'
+ btnSecondarySelector + ' { background-color: ' + value + ' }'
+ '</style>'
) ;
}
} ) ;
} ) ;
/ * *
* Cart Count Color .
* /
wp . customize ( 'astra-settings[woo-header-cart-product-count-color]' , function ( setting ) {
setting . bind ( function ( color ) {
if ( color ) {
var dynamicStyle = '.ast-menu-cart-outline .ast-cart-menu-wrap .count, .ast-site-header-cart .ast-addon-cart-wrap i.astra-icon:after { color: ' + color + '; } ' ;
astra _add _dynamic _css ( 'woo-header-cart-product-count-color' , dynamicStyle ) ;
} else {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
/ * *
* Cart Count Color Hover .
* /
wp . customize ( 'astra-settings[woo-header-cart-product-count-h-color]' , function ( setting ) {
setting . bind ( function ( color ) {
if ( color ) {
var dynamicStyle = '.ast-site-header-cart .ast-site-header-cart-li:hover .ast-cart-menu-wrap .count .ast-count-text, .ast-site-header-cart .ast-site-header-cart-li:hover .ast-addon-cart-wrap i.astra-icon:after { color: ' + color + '; } ' ;
astra _add _dynamic _css ( 'woo-header-cart-product-count-h-color' , dynamicStyle ) ;
} else {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
wp . customize ( 'astra-settings[single-product-cart-button-width]' , function ( value ) {
value . bind ( function ( size ) {
var tablet _break _point = astraBuilderPreview . tablet _break _point || 768 ,
mobile _break _point = astraBuilderPreview . mobile _break _point || 544 ;
if ( size . desktop != '' || size . tablet != '' || size . mobile != '' ) {
var dynamicStyle = '' ;
dynamicStyle += '.woocommerce div.product form.cart .button.single_add_to_cart_button {' ;
dynamicStyle += 'width: ' + size . desktop + '%' + ';' ;
dynamicStyle += '} ' ;
dynamicStyle += '@media (max-width: ' + tablet _break _point + 'px) {' ;
dynamicStyle += '.woocommerce div.product form.cart .button.single_add_to_cart_button {' ;
dynamicStyle += 'width: ' + size . tablet + '%' + ';' ;
dynamicStyle += '} ' ;
dynamicStyle += '} ' ;
dynamicStyle += '@media (max-width: ' + mobile _break _point + 'px) {' ;
dynamicStyle += '.woocommerce div.product form.cart .button.single_add_to_cart_button {' ;
dynamicStyle += 'width: ' + size . mobile + '%' + ';' ;
dynamicStyle += '} ' ;
dynamicStyle += '} ' ;
astra _add _dynamic _css ( 'header-woo-cart-icon-size' , dynamicStyle ) ;
} else {
wp . customize . preview . send ( 'refresh' ) ;
}
} ) ;
} ) ;
// Single product Sticky add to cart.
const astraStickyAddToCartBtnColor = '.woocommerce .ast-sticky-add-to-cart .button.alt' ;
const astraStickyAddToCartBtnHover = '.woocommerce .ast-sticky-add-to-cart .button.alt:hover' ;
astra _css ( 'astra-settings[single-product-sticky-add-to-cart-btn-n-color]' , 'color' , astraStickyAddToCartBtnColor ) ;
astra _css ( 'astra-settings[single-product-sticky-add-to-cart-btn-h-color]' , 'color' , astraStickyAddToCartBtnHover ) ;
astra _css ( 'astra-settings[single-product-sticky-add-to-cart-btn-bg-n-color]' , 'background' , astraStickyAddToCartBtnColor ) ;
astra _css ( 'astra-settings[single-product-sticky-add-to-cart-btn-bg-h-color]' , 'background' , astraStickyAddToCartBtnHover ) ;
astra _css ( 'astra-settings[single-product-sticky-add-to-cart-btn-bg-n-color]' , 'border-color' , astraStickyAddToCartBtnColor ) ;
astra _css ( 'astra-settings[single-product-sticky-add-to-cart-btn-bg-h-color]' , 'border-color' , astraStickyAddToCartBtnHover ) ;
astra _css ( 'astra-settings[single-product-sticky-add-to-cart-text-color]' , 'color' , '.ast-sticky-add-to-cart .ast-container .ast-sticky-add-to-cart-content' ) ;
astra _css ( 'astra-settings[single-product-sticky-add-to-cart-bg-color]' , 'background-color' , '.ast-sticky-add-to-cart' ) ;
wp . customize ( 'astra-settings[single-product-sticky-add-to-cart-position]' , function ( setting ) {
setting . bind ( function ( position ) {
var dynamicStyle = '' ;
if ( 'top' === position ) {
dynamicStyle += 'div.ast-sticky-add-to-cart{' ;
dynamicStyle += 'top: 0;' ;
dynamicStyle += 'bottom: initial;' ;
dynamicStyle += 'transform: translate(0, -100%);' ;
dynamicStyle += 'box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.1), 0px 1px 9px rgba(0, 0, 0, 0.06);' ;
dynamicStyle += 'opacity: 0' ;
dynamicStyle += '}' ;
} else {
dynamicStyle += 'div.ast-sticky-add-to-cart{' ;
dynamicStyle += 'bottom: 0;' ;
dynamicStyle += 'top: initial;' ;
dynamicStyle += 'transform: translate(0, 100%);' ;
dynamicStyle += 'box-shadow: 0px -1px 10px rgba(0, 0, 0, 0.1), 0px -1px 9px rgba(0, 0, 0, 0.06);' ;
dynamicStyle += 'opacity: 0' ;
dynamicStyle += '}' ;
}
astra _add _dynamic _css ( 'sticky-add-to-cart-position' , dynamicStyle ) ;
} ) ;
} ) ;
wp . customize ( 'astra-settings[single-product-payment-icon-color]' , function ( setting ) {
setting . bind ( function ( value ) {
wp . customize . preview . send ( 'refresh' ) ;
} ) ;
} ) ;
wp . customize ( 'astra-settings[shop-ratings-product-archive]' , function ( setting ) {
setting . bind ( function ( value ) {
wp . customize . preview . send ( 'refresh' ) ;
} ) ;
} ) ;
wp . customize ( 'astra-settings[single-product-payment-text]' , function ( setting ) {
setting . bind ( function ( text ) {
const paymentText = document . querySelector ( '.ast-single-product-payments legend' ) ;
if ( paymentText ) {
paymentText . textContent = text ;
}
} ) ;
} ) ;
wp . customize ( 'astra-settings[single-product-payment-list]' , function ( setting ) {
setting . bind ( function ( value ) {
wp . customize . preview . send ( 'refresh' ) ;
} ) ;
} ) ;
}
} ) ( jQuery ) ;