2

I'm trying to customize the look of the iframe that pops up (media uploader).

I've manage to remove some fields etc, but I cannot re-size the frame. Does anybody know how to do this?

1 Answer 1

0

The default media box has hard coded HTML values so in order to alter the CSS for it you you have 2 options.

  1. Enqueue your own CSS and override the values
  2. Disable media-views.css completely and load a custom stylesheet.

To enqueue your own style:

function blah_admin_css() {
    wp_enqueue_style( 'blah_admin_css', path to your custom.css );
}
add_action('admin_print_styles', 'blah_admin_css' );

Now just add whatever you want to a custom.css file to override the CSS values, you might have to use the dreaded !important.

To completely disable the admin CSS from loading for the media box you need to hook into wp_default_styles and the name which happens to be media-views.

For example:

function remove_media_style($wp_styles ){
    $wp_styles->remove('media-views');
}
add_action('wp_default_styles', 'remove_media_style');

You should use a plugin to do this since you just have to disable it to revert back to the original style.

ps. There is a 3rd option, just use javascript, and generally speaking all 3 options are a bad idea.

2
  • Thanks for the help, the problem is I am already pulling in a custom CSS file BUT the styles I want to change are inline which means the CSS file just gets over written
    – RICKY DAWN
    Jun 14, 2013 at 8:41
  • The default media box styles aren't inline, you can override them using !important unless you have javascript turned off.
    – Wyck
    Jun 14, 2013 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.