Skip to content

Instantly share code, notes, and snippets.

@ericnicolaas
Created July 10, 2014 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericnicolaas/349c4550c23e90be53b7 to your computer and use it in GitHub Desktop.
Save ericnicolaas/349c4550c23e90be53b7 to your computer and use it in GitHub Desktop.
Option 1: Retina image control in the Wordpress Customizer
/**
* Retina image control.
*
* Essentially, you just create two separate image controls, one of which is for the regular version of the logo,
* the other for the retina version.
*
* This is a simple solution with a few downsides:
*
* 1. It can be confusing for users who may not understand what is required for a retina version.
* 2. There is nothing enforcing the 2x sizing of the retina version.
*/
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'logo_url',
array(
'settings' => 'logo_url',
'section' => 'title_tagline',
'label' => __( 'Logo', 'my_theme' )
) )
);
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'retina_logo_url',
array(
'settings' => 'retina_logo_url',
'section' => 'title_tagline',
'label' => __( 'Retina version of logo (2x)', 'my_theme' )
) )
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment