_custom_background_cb

Definition:
function _custom_background_cb() {}

Default custom background callback.

Source code

function _custom_background_cb() {

	$background = get_background_image();

	$color = get_background_color();

	if ( ! $background && ! $color )

		return;



	$style = $color ? "background-color: #$color;" : '';



	if ( $background ) {

		$image = " background-image: url('$background');";



		$repeat = get_theme_mod( 'background_repeat', 'repeat' );

		if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )

			$repeat = 'repeat';

		$repeat = " background-repeat: $repeat;";



		$position = get_theme_mod( 'background_position_x', 'left' );

		if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )

			$position = 'left';

		$position = " background-position: top $position;";



		$attachment = get_theme_mod( 'background_attachment', 'scroll' );

		if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )

			$attachment = 'scroll';

		$attachment = " background-attachment: $attachment;";



		$style .= $image . $repeat . $position . $attachment;

	}

?>

<style type="text/css">

body.custom-background { <?php echo trim( $style ); ?> }

</style>

<?php

}

4305

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: