741 posts
  • Had an item featured on Envato Market
  • Won a Most Wanted contest
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
+4 more
Orbital_Themes says

Is there any way to overwrite the default media settings (image sizes) from within my theme?

I don’t want to get thousands of support request about images having wrong sizes just because someone didn’t read theme documentation and didn’t set the image sizes correctly. :(

229 posts
  • Has been part of the Envato Community for over 3 years
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
  • Located in United States
Pressateers says
http://codex.wordpress.org/Function_Reference/add_image_size

Then when you use wp_get_attachment_src you specify the name of the size you added.

741 posts
  • Had an item featured on Envato Market
  • Won a Most Wanted contest
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
+4 more
Orbital_Themes says

I think you misunderstood me. I was asking about how to overwrite the default WP media settings. By default, when you install WordPress, the thumbnail size is set to 150×150.

Now I don’t wan’t to add separate thumbnail size, and this way create unnecessary bloat in uploads folder since my theme won’t even use the 150×150 size.

I wan’t to be able to overwrite media settings when my theme is activated. The set_post_thumbnail_size doesn’t seem to change the default 150×150 that is set in media settings.

229 posts
  • Has been part of the Envato Community for over 3 years
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
  • Located in United States
Pressateers says

I don’t believe it will physically change the value in Media Settings, but it will work for your theme provided you have this code set in functions.php:

 add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size(...);
1659 posts Building the Web.
  • Has been a beta tester for an Envato feature
  • Sells items exclusively on Envato Market
  • Has sold $250,000+ on Envato Market
  • Had an item featured on Envato Market
+7 more
ZoomIt says

do a wpdb UPDATE query on theme activation for wp->prefix.’options’ ..

               64    0    thumbnail_size_w    150    yes
               65    0    thumbnail_size_h    150
and
67    0    medium_size_w    300    yes
               68    0    medium_size_h    300
and whatever you wish

741 posts
  • Had an item featured on Envato Market
  • Won a Most Wanted contest
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
+4 more
Orbital_Themes says

Nice, that’s what I was looking for :D But… Could you possibly share the full code for it? I’m not good in manually messing with database.

1659 posts Building the Web.
  • Has been a beta tester for an Envato feature
  • Sells items exclusively on Envato Market
  • Has sold $250,000+ on Envato Market
  • Had an item featured on Envato Market
+7 more
ZoomIt says

Yeah sure -


if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ){
    global $DZSContactForm, $wpdb;

    $wpdb->query("UPDATE $wpdb->options
SET option_value='145'
WHERE option_name='thumbnail_size_w'");

    $wpdb->query("UPDATE $wpdb->options
SET option_value='145'
WHERE option_name='thumbnail_size_h'");

}

I charge 7,499.99US$ / hour – I’ll wait the payment on PayPal for an hour

741 posts
  • Had an item featured on Envato Market
  • Won a Most Wanted contest
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
+4 more
Orbital_Themes says

Thank you ZoomIt, this is a very nice function but I won’t pay for it. My girlfriend doesn’t like it too much. There is a reference to $DZSContactForm object, which, she says, is not utilized in my framework. She doesn’t like having undefined objects in my functions. Sorry for inconvenience.

Wish you all the best, Mateusz

1659 posts Building the Web.
  • Has been a beta tester for an Envato feature
  • Sells items exclusively on Envato Market
  • Has sold $250,000+ on Envato Market
  • Had an item featured on Envato Market
+7 more
ZoomIt says

Yea, you can just delete that reference

Glad to help

741 posts
  • Had an item featured on Envato Market
  • Won a Most Wanted contest
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
+4 more
Orbital_Themes says

I was just kidding mate, thanks for helping :)

by
by
by
by
by
by