WordPress.org

Ready to get started?Download WordPress

Forums

Making a Theme Customizer control class for .ico files (1 post)

  1. Scott Smith
    Member
    Posted 1 year ago #

    While adding a theme option for users of my theme to upload favicons (due to [http://wordpress.org/support/topic/please-allow-standard-ico-favicon-file 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.

Topic Closed

This topic has been closed to new replies.

About this Topic