Created
August 28, 2014 15:32
-
-
Save smutek/1fc1f492b1aebbddda8d to your computer and use it in GitHub Desktop.
WP Theme Customizer SVG Blues
This file contains 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
/* Trying to get the theme customizer to accept SVG, no luck.... */ | |
// add svg support for media uploader | |
function cc_mime_types( $mimes ){ | |
$mimes['svg'] = 'image/svg+xml'; | |
return $mimes; | |
} | |
add_filter( 'upload_mimes', 'cc_mime_types' ); | |
// fix SVG display in admin | |
function custom_admin_head() { | |
$css = ''; | |
$css = 'td.media-icon img[src$=".svg"] { width: 100% !important; height: auto !important; }'; | |
echo '<style type="text/css">'.$css.'</style>'; | |
} | |
add_action('admin_head', 'custom_admin_head'); | |
//******* Theme Customizer Set Up ********** | |
function ppb_theme_customizer( $wp_customize ) { | |
$wp_customize->add_section( 'ppb_logo_section' , array( | |
'title' => __( 'Theme Logo', 'ppb' ), | |
'priority' => 30, | |
'description' => 'Upload your logo to replace the default site name and description in the header', | |
) ); | |
$wp_customize->add_setting( 'ppb_logo' ); | |
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'ppb_logo', array( | |
'label' => __( 'Upload Logo', 'ppb' ), | |
'section' => 'ppb_logo_section', | |
'settings' => 'ppb_logo', | |
) ) ); | |
} | |
add_action('customize_register', 'ppb_theme_customizer'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment