Support » Plugins » Hacks » Making a Theme Customizer control class for .ico files

  • While adding a theme option for users of my theme to upload favicons (due to [ this request],) I realized that the WP_Customize_Image_Control class doesn’t accept .ico image uploads. When the image upload dialogue was selected, .ico files would not be a selectable option, so I tried extending the WP_Customize_Image_Control class which was unsuccessful and then tried extending the WP_Customize_Upload_Control class in similar fashion to the WP_Customize_Image_Control class. Unfortunately, only png files are allowed and ice files are not. I’ve added both the mime type and file extension for the .ico file and neither allows the image to be selected.

    This is what I ended up with:

    class Decode_Customize_Favicon_Image_Control extends WP_Customize_Upload_Control {
    public $extensions = array( ‘ico’, ‘png’, ‘image/x-icon’ );

    This seems to be due to the fact that the JavaScript responsible for image uploads in wp-includes/js/plupload/plupload.js doesn’t have .ico files in it’s list of file types.

    At this point, my abilities end. Thanks for hearing me out.

  • The topic ‘Making a Theme Customizer control class for .ico files’ is closed to new replies.