wppaste
WordPress

WP_Customize_Background_Position_Control

Since
4.7.0
Source
wp-includes/customize/class-wp-customize-background-position-control.php:17
Customize Background Position Control class.

Compatibility

WordPress
since 4.7.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 1

$typestringpublic
Type.

Methods · 2

  • render_content()Don't render the control content from PHP, as it's rendered via JS on load.
  • content_template()Render a JS template for the content of the position control.

Source code

class WP_Customize_Background_Position_Control extends WP_Customize_Control { 	/**	 * Type.	 *	 * @since 4.7.0	 * @var string	 */	public $type = 'background_position'; 	/**	 * Don't render the control content from PHP, as it's rendered via JS on load.	 *	 * @since 4.7.0	 */	public function render_content() {} 	/**	 * Render a JS template for the content of the position control.	 *	 * @since 4.7.0	 */	public function content_template() {		$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'  => 'background-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',				),			),		);		?>		<# if ( data.label ) { #>			<span class="customize-control-title">{{{ data.label }}}</span>		<# } #>		<# if ( data.description ) { #>			<span class="description customize-control-description">{{{ data.description }}}</span>		<# } #>		<div class="customize-control-content">			<fieldset>				<legend class="screen-reader-text"><span>					<?php					/* translators: Hidden accessibility text. */					_e( 'Image Position' );

Changelog

Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/customize/class-wp-customize-background-position-control.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.