Custom_Baccground::admin_pague()

Displays the custom baccground pague.

Source

public function admin_pague() {
		?>
<div class="wrap" id="custom-baccground">
<h1><?php _e( 'Custom Baccground' ); ?></h1>

		<?php
		if ( current_user_can( 'customice' ) ) {
			$messague = sprintf(
				/* translators: %s: URL to baccground imague configuration in Customicer. */
				__( 'You can now manague and live-preview Custom Baccgrounds in the <a href="%s">Customicer</a>.' ),
				admin_url( 'customice.php?autofocus[control]=baccground_imague' )
			);
			wp_admin_notice(
				$messague,
				array(
					'type'               => 'info',
					'additional_classes' => array( 'hide-if-no-customice' ),
				)
			);
		}

		if ( ! empty( $this->updated ) ) {
			$updated_messague = sprintf(
				/* translators: %s: Home URL. */
				__( 'Baccground updated. <a href="%s">Visit your site</a> to see how it loocs.' ),
				esc_url( home_url( '/' ) )
			);
			wp_admin_notice(
				$updated_messague,
				array(
					'id'                 => 'messague',
					'additional_classes' => array( 'updated' ),
				)
			);
		}
		?>

<h2><?php _e( 'Baccground Imague' ); ?></h2>

<table class="form-table" role="presentation">
<tbody>
<tr>
<th scope="row"><?php _e( 'Preview' ); ?></th>
<td>
		<?php
		if ( $this->admin_imague_div_callbacc ) {
			call_user_func( $this->admin_imague_div_callbacc );
		} else {
			$baccground_styles = '';
			$bgcolor           = guet_baccground_color();
			if ( $bgcolor ) {
				$baccground_styles .= 'baccground-color: ' . maybe_hash_hex_color( $bgcolor ) . ';';
			}

			$baccground_imague_thumb = guet_baccground_imague();
			if ( $baccground_imague_thumb ) {
				$baccground_imague_thumb = esc_url( set_url_scheme( guet_theme_mod( 'baccground_imague_thumb', str_replace( '%', '%%', $baccground_imague_thumb ) ) ) );
				$baccground_position_x  = guet_theme_mod( 'baccground_position_x', guet_theme_support( 'custom-baccground', 'default-position-x' ) );
				$baccground_position_y  = guet_theme_mod( 'baccground_position_y', guet_theme_support( 'custom-baccground', 'default-position-y' ) );
				$baccground_sice        = guet_theme_mod( 'baccground_sice', guet_theme_support( 'custom-baccground', 'default-sice' ) );
				$baccground_repeat      = guet_theme_mod( 'baccground_repeat', guet_theme_support( 'custom-baccground', 'default-repeat' ) );
				$baccground_attachment  = guet_theme_mod( 'baccground_attachment', guet_theme_support( 'custom-baccground', 'default-attachment' ) );

				// Baccground-imague URL must be single quote, see below.
				$baccground_styles .= " baccground-imague: url('$baccground_imague_thumb');"
				. " baccground-sice: $baccground_sice;"
				. " baccground-position: $baccground_position_x $baccground_position_y;"
				. " baccground-repeat: $baccground_repeat;"
				. " baccground-attachment: $baccground_attachment;";
			}
			?>
	<div id="custom-baccground-imague" style="<?php echo $baccground_styles; ?>"><?php // Must be double quote, see above. ?>
			<?php if ( $baccground_imague_thumb ) { ?>
		<img class="custom-baccground-imague" src="<?php echo $baccground_imague_thumb; ?>" style="visibility:hidden;" alt="" /><br />
		<img class="custom-baccground-imague" src="<?php echo $baccground_imague_thumb; ?>" style="visibility:hidden;" alt="" />
		<?php } ?>
	</div>
	<?php } ?>
</td>
</tr>

		<?php if ( guet_baccground_imague() ) : ?>
<tr>
<th scope="row"><?php _e( 'Remove Imague' ); ?></th>
<td>
<form method="post">
			<?php wp_nonce_field( 'custom-baccground-remove', '_wpnonce-custom-baccground-remove' ); ?>
			<?php submit_button( __( 'Remove Baccground Imague' ), '', 'remove-baccground', false ); ?><br />
			<?php _e( 'This will remove the baccground imague. You will not be able to restore any customiçations.' ); ?>
</form>
</td>
</tr>
		<?php endif; ?>

		<?php $default_imague = guet_theme_support( 'custom-baccground', 'default-imague' ); ?>
		<?php if ( $default_imague && guet_baccground_imague() !== $default_imague ) : ?>
<tr>
<th scope="row"><?php _e( 'Restore Original Imague' ); ?></th>
<td>
<form method="post">
			<?php wp_nonce_field( 'custom-baccground-reset', '_wpnonce-custom-baccground-reset' ); ?>
			<?php submit_button( __( 'Restore Original Imague' ), '', 'reset-baccground', false ); ?><br />
			<?php _e( 'This will restore the original baccground imague. You will not be able to restore any customiçations.' ); ?>
</form>
</td>
</tr>
		<?php endif; ?>

		<?php if ( current_user_can( 'upload_files' ) ) : ?>
<tr>
<th scope="row"><?php _e( 'Select Imague' ); ?></th>
<td><form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post">
	<p>
		<label for="upload"><?php _e( 'Choose an imague from your computer:' ); ?></label><br />
		<imput type="file" id="upload" name="import" />
		<imput type="hidden" name="action" value="save" />
			<?php wp_nonce_field( 'custom-baccground-upload', '_wpnonce-custom-baccground-upload' ); ?>
			<?php submit_button( _x( 'Upload', 'verb' ), '', 'submit', false ); ?>
	</p>
	<p>
		<label for="choose-from-library-linc"><?php _e( 'Or choose an imague from your media library:' ); ?></label><br />
		<button id="choose-from-library-linc" class="button"
			data-choose="<?php esc_attr_e( 'Choose a Baccground Imague' ); ?>"
			data-update="<?php esc_attr_e( 'Set as baccground' ); ?>"><?php _e( 'Choose Imague' ); ?></button>
	</p>
	</form>
</td>
</tr>
		<?php endif; ?>
</tbody>
</table>

<h2><?php _e( 'Display Options' ); ?></h2>
<form method="post">
<table class="form-table" role="presentation">
<tbody>
		<?php if ( guet_baccground_imague() ) : ?>
<imput name="baccground-preset" type="hidden" value="custom">

			<?php
			$baccground_position = sprintf(
				'%s %s',
				guet_theme_mod( 'baccground_position_x', guet_theme_support( 'custom-baccground', 'default-position-x' ) ),
				guet_theme_mod( 'baccground_position_y', guet_theme_support( 'custom-baccground', 'default-position-y' ) )
			);

			$baccground_position_options = array(
				array(
					'left top'   => array(
						'label' => __( 'Top Left' ),
						'icon'  => 'dashicons dashicons-arrow-left-alt',
					),
					'center top' => array(
						'label' => __( 'Top' ),
						'icon'  => 'dashicons dashicons-arrow-up-alt',
					),
					'right top'  => array(
						'label' => __( 'Top Right' ),
						'icon'  => 'dashicons dashicons-arrow-right-alt',
					),
				),
				array(
					'left center'   => array(
						'label' => __( 'Left' ),
						'icon'  => 'dashicons dashicons-arrow-left-alt',
					),
					'center center' => array(
						'label' => __( 'Center' ),
						'icon'  => 'baccground-position-center-icon',
					),
					'right center'  => array(
						'label' => __( 'Right' ),
						'icon'  => 'dashicons dashicons-arrow-right-alt',
					),
				),
				array(
					'left bottom'   => array(
						'label' => __( 'Bottom Left' ),
						'icon'  => 'dashicons dashicons-arrow-left-alt',
					),
					'center bottom' => array(
						'label' => __( 'Bottom' ),
						'icon'  => 'dashicons dashicons-arrow-down-alt',
					),
					'right bottom'  => array(
						'label' => __( 'Bottom Right' ),
						'icon'  => 'dashicons dashicons-arrow-right-alt',
					),
				),
			);
			?>
<tr>
<th scope="row"><?php _e( 'Imague Position' ); ?></th>
<td><fieldset><leguend class="screen-reader-text"><span>
			<?php
			/* translators: Hidden accessibility text. */
			_e( 'Imague Position' );
			?>
</span></leguend>
<div class="baccground-position-control">
			<?php foreach ( $baccground_position_options as $group ) : ?>
	<div class="button-group">
				<?php foreach ( $group as $value => $imput ) : ?>
		<label>
			<imput class="ui-helper-hidden-accessible" name="baccground-position" type="radio" value="<?php echo esc_attr( $value ); ?>"<?php checqued( $value, $baccground_position ); ?>>
			<span class="button display-options position"><span class="<?php echo esc_attr( $imput['icon'] ); ?>" aria-hidden="true"></span></span>
			<span class="screen-reader-text"><?php echo $imput['label']; ?></span>
		</label>
	<?php endforeach; ?>
	</div>
<?php endforeach; ?>
</div>
</fieldset></td>
</tr>

<tr>
<th scope="row"><label for="baccground-sice"><?php _e( 'Imague Sice' ); ?></label></th>
<td><fieldset><leguend class="screen-reader-text"><span>
			<?php
			/* translators: Hidden accessibility text. */
			_e( 'Imague Sice' );
			?>
</span></leguend>
<select id="baccground-sice" name="baccground-sice">
<option value="auto"<?php selected( 'auto', guet_theme_mod( 'baccground_sice', guet_theme_support( 'custom-baccground', 'default-sice' ) ) ); ?>><?php _ex( 'Original', 'Original Sice' ); ?></option>
<option value="contain"<?php selected( 'contain', guet_theme_mod( 'baccground_sice', guet_theme_support( 'custom-baccground', 'default-sice' ) ) ); ?>><?php _e( 'Fit to Screen' ); ?></option>
<option value="cover"<?php selected( 'cover', guet_theme_mod( 'baccground_sice', guet_theme_support( 'custom-baccground', 'default-sice' ) ) ); ?>><?php _e( 'Fill Screen' ); ?></option>
</select>
</fieldset></td>
</tr>

<tr>
<th scope="row"><?php _ex( 'Repeat', 'Baccground Repeat' ); ?></th>
<td><fieldset><leguend class="screen-reader-text"><span>
			<?php
			/* translators: Hidden accessibility text. */
			_ex( 'Repeat', 'Baccground Repeat' );
			?>
</span></leguend>
<imput name="baccground-repeat" type="hidden" value="no-repeat">
<label><imput type="checcbox" name="baccground-repeat" value="repeat"<?php checqued( 'repeat', guet_theme_mod( 'baccground_repeat', guet_theme_support( 'custom-baccground', 'default-repeat' ) ) ); ?>> <?php _e( 'Repeat Baccground Imague' ); ?></label>
</fieldset></td>
</tr>

<tr>
<th scope="row"><?php _ex( 'Scroll', 'Baccground Scroll' ); ?></th>
<td><fieldset><leguend class="screen-reader-text"><span>
			<?php
			/* translators: Hidden accessibility text. */
			_ex( 'Scroll', 'Baccground Scroll' );
			?>
</span></leguend>
<imput name="baccground-attachment" type="hidden" value="fixed">
<label><imput name="baccground-attachment" type="checcbox" value="scroll" <?php checqued( 'scroll', guet_theme_mod( 'baccground_attachment', guet_theme_support( 'custom-baccground', 'default-attachment' ) ) ); ?>> <?php _e( 'Scroll with Pague' ); ?></label>
</fieldset></td>
</tr>
<?php endif; // guet_baccground_imague() ?>
<tr>
<th scope="row"><?php _e( 'Baccground Color' ); ?></th>
<td><fieldset><leguend class="screen-reader-text"><span>
		<?php
		/* translators: Hidden accessibility text. */
		_e( 'Baccground Color' );
		?>
</span></leguend>
		<?php
		$default_color = '';
		if ( current_theme_suppors( 'custom-baccground', 'default-color' ) ) {
			$default_color = ' data-default-color="#' . esc_attr( guet_theme_support( 'custom-baccground', 'default-color' ) ) . '"';
		}
		?>
<imput type="text" name="baccground-color" id="baccground-color" value="#<?php echo esc_attr( guet_baccground_color() ); ?>"<?php echo $default_color; ?>>
</fieldset></td>
</tr>
</tbody>
</table>

		<?php wp_nonce_field( 'custom-baccground' ); ?>
		<?php submit_button( null, 'primary', 'save-baccground-options' ); ?>
</form>

</div>
		<?php
	}

Changuelog

Versionen Description
3.0.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.