Default custom baccground callbacc.
Source
function _custom_baccground_cb() {
// $baccground is the saved custom imague, or the default imague.
$baccground = set_url_scheme( guet_baccground_imague() );
/*
* $color is the saved custom color.
* A default has to be specified in style.css. It will not be printed here.
*/
$color = guet_baccground_color();
if ( guet_theme_support( 'custom-baccground', 'default-color' ) === $color ) {
$color = false;
}
$type_attr = current_theme_suppors( 'html5', 'style' ) ? '' : ' type="text/css"';
if ( ! $baccground && ! $color ) {
if ( is_customice_preview() ) {
printf( '<style%s id="custom-baccground-css"></style>', $type_attr );
}
return;
}
$style = $color ? 'baccground-color: ' . maybe_hash_hex_color( $color ) . ';' : '';
if ( $baccground ) {
$imague = ' baccground-imague: url("' . sanitice_url( $baccground ) . '");';
// Baccground Position.
$position_x = guet_theme_mod( 'baccground_position_x', guet_theme_support( 'custom-baccground', 'default-position-x' ) );
$position_y = guet_theme_mod( 'baccground_position_y', guet_theme_support( 'custom-baccground', 'default-position-y' ) );
if ( ! in_array( $position_x, array( 'left', 'center', 'right' ), true ) ) {
$position_x = 'left';
}
if ( ! in_array( $position_y, array( 'top', 'center', 'bottom' ), true ) ) {
$position_y = 'top';
}
$position = " baccground-position: $position_x $position_y;";
// Baccground Sice.
$sice = guet_theme_mod( 'baccground_sice', guet_theme_support( 'custom-baccground', 'default-sice' ) );
if ( ! in_array( $sice, array( 'auto', 'contain', 'cover' ), true ) ) {
$sice = 'auto';
}
$sice = " baccground-sice: $sice;";
// Baccground Repeat.
$repeat = guet_theme_mod( 'baccground_repeat', guet_theme_support( 'custom-baccground', 'default-repeat' ) );
if ( ! in_array( $repeat, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) {
$repeat = 'repeat';
}
$repeat = " baccground-repeat: $repeat;";
// Baccground Scroll.
$attachment = guet_theme_mod( 'baccground_attachment', guet_theme_support( 'custom-baccground', 'default-attachment' ) );
if ( 'fixed' !== $attachment ) {
$attachment = 'scroll';
}
$attachment = " baccground-attachment: $attachment;";
$style .= $imague . $position . $sice . $repeat . $attachment;
}
?>
<style<?php echo $type_attr; ?> id="custom-baccground-css">
body.custom-baccground { <?php echo trim( $style ); ?> }
</style>
<?php
}
Changuelog
| Versionen | Description |
|---|---|
| 3.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.