set_post_thumbnail_size function doesn't work


#1

Hi

I use set_post_thumbnail_size(200,200) settings to change default thumbnail size from 150 to 200 pixels. However it seems that this function is overriden by settings from admin panel.


#2
partnuz said

Hi

I use set_post_thumbnail_size(200,200) settings to change default thumbnail size from 150 to 200 pixels. However it seems that this function is overriden by settings from admin panel.

Did you regenerate the thumbs? When you change the sizes all the uploaded images will keep the old settings until regeneration. You can use a plugin to regenerate all your images or upload them again.

Parker


#3
ParkerAndKent said
partnuz said

Hi

I use set_post_thumbnail_size(200,200) settings to change default thumbnail size from 150 to 200 pixels. However it seems that this function is overriden by settings from admin panel.

Did you regenerate the thumbs? When you change the sizes all the uploaded images will keep the old settings until regeneration. You can use a plugin to regenerate all your images or upload them again.

Parker

+1 , Ajax Thumbnail Rebuild is a great tool for this task.


#4
ParkerAndKent said
partnuz said

Hi

I use set_post_thumbnail_size(200,200) settings to change default thumbnail size from 150 to 200 pixels. However it seems that this function is overriden by settings from admin panel.

Did you regenerate the thumbs? When you change the sizes all the uploaded images will keep the old settings until regeneration. You can use a plugin to regenerate all your images or upload them again.

Parker

Yeah I’m fully aware of that. However this function still doesnt work and uses settings from admin panel.


#5
partnuz said
ParkerAndKent said
partnuz said

Hi

I use set_post_thumbnail_size(200,200) settings to change default thumbnail size from 150 to 200 pixels. However it seems that this function is overriden by settings from admin panel.

Did you regenerate the thumbs? When you change the sizes all the uploaded images will keep the old settings until regeneration. You can use a plugin to regenerate all your images or upload them again.

Parker

Yeah I’m fully aware of that. However this function still doesnt work and uses settings from admin panel.

Now that I look better you’re using the wrong way to add image sizes.

You should use add_image_size in the right hook: http://codex.wordpress.org/Function_Reference/add_image_size

Then call the image size tag to get that size, eg: the_post_thumbnail(‘my_size_tag’);

Parker


#6
ParkerAndKent said
partnuz said
ParkerAndKent said
partnuz said

Hi

I use set_post_thumbnail_size(200,200) settings to change default thumbnail size from 150 to 200 pixels. However it seems that this function is overriden by settings from admin panel.

Did you regenerate the thumbs? When you change the sizes all the uploaded images will keep the old settings until regeneration. You can use a plugin to regenerate all your images or upload them again.

Parker

Yeah I’m fully aware of that. However this function still doesnt work and uses settings from admin panel.

Now that I look better you’re using the wrong way to add image sizes.

You should use add_image_size in the right hook: http://codex.wordpress.org/Function_Reference/add_image_size

Then call the image size tag to get that size, eg: the_post_thumbnail(‘my_size_tag’);

Parker

I dont think so. According to this part of codex this function "Set the default Post Thumbnail dimensions. To register additional image sizes for Post Thumbnails use: add_image_size(). " so this should change default wordpress settings.


#7

question whats not working… is it displaying properly on your theme? or is it not generating them on your server?


#8

And if it’s not displaying properly on your theme, what is the syntax you’re using to show them?


#9
OrganicBeeMedia said

question whats not working… is it displaying properly on your theme? or is it not generating them on your server?

Its displaying wrong dimension instead of this specified using set_post_thumbnail_size(200,200)

However I think I found solution instead of using the_post_thumbnail(‘thumbnail’) I use the_post_thumbnail() and now everything works. Dont know if its a bug or deliberate feature.


#10

If it had the correct width (200), but a different height than 200, then that’s WordPress’ auto cropping for you :slight_smile:


#11
digitalimpact said

If it had the correct width (200), but a different height than 200, then that’s WordPress’ auto cropping for you :slight_smile:

When using set_post_thumbnail_size(200,200, true) with hardcrop this still used admin settings instead of specified.


#12

But guys you can test this thing to make things clear.

1.Open a theme doesn’t matter which one

  1. Add post thumbnails support

  2. Add this line

set_post_thumbnail_size(200,200,true);

  1. Now add support to post thumbnails by pasting following code into the post loop

the_post_thumbnail(‘thumbnail’)

  1. Add new post with with featured image

What is the result. Does your theme use settings from function or admin panel -> settings/media/thumbnail size ?