Created
July 10, 2014 23:09
-
-
Save ericnicolaas/349c4550c23e90be53b7 to your computer and use it in GitHub Desktop.
Option 1: Retina image control in the Wordpress Customizer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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