add_image_size function not working
All images before you added new image size will not be resized. You must regenerate all thumbnails. There are lots of thumbnail regeneration plugins that you can use.
All images before you added new image size will not be resized. You must regenerate all thumbnails. There are lots of thumbnail regeneration plugins that you can use.
General idea would be to loop through all attachments to retrieve, modify and write back their meta. Something like this (test thoroughly before using on anything important): $posts = get_posts(array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, )); foreach( $posts as $post ) { // retrieve data, unserialized automatically $meta = get_post_meta($post->ID,’_wp_attachment_metadata’, true); // do stuff … Read more
As long as you use WP API ($wpdb) to perform queries, they will be cached by caching plugins (well, by those that have such functionality). If you need to cache data that is more compelx to generate rather than just retrieve look into Transients API.
Turn off PHP Safe Mode, or get your host to do it for you. Lots and lots of things won’t work in safe mode. C’mon. Live on the edge. That’s where the fun is. 🙂
Try using wp_get_attachment_image() (Codex ref)? echo wp_get_attachment_image( $attachmentid, $imagesize ); Where $attachmentid is the attachment ID, and $imagesize is the name of the image size in the add_image_size() call. EDIT For a custom-field stored image SRC URL, I’m not finding any way to make use of intermediate image sizes defined via add_image_size() (or even the … Read more
This is not very reliable in general (especially not in multisite environment), but for specific case it can be good enough: $url=”http://localhost/wp-content/uploads/2011/06/sample.jpg”; $uploads = wp_upload_dir(); $path = str_replace( $uploads[‘baseurl’], $uploads[‘basedir’], $url);
This functionality is Plugin territory. I strongly believe that the WordPress core team will never consider such functionality for WordPress core. Besides: such functionality is also pointless. Anyone who wants an image badly enough is going to be able to get them. (They can disable javascript thereby defeating the Plugin entirely; they can view source … Read more
When you upload an image via the media library, additional sizes are created: large, medium, thumbnail, plus any additional sizes defined by plugins or your theme. If your theme displays any sizes other than the original, un-resized image, you’ll have to regenerate those additional sizes to see any changes take effect. If this is the … Read more
You are not using set_post_thumbnail_size properly. Try with: add_image_size( ’emphasis’, 132, 82, true );
Your not specifying a $crop value so your images are being cropped using a soft proportional crop. Set crop to TRUE for a hard crop. add_image_size( ‘sidebar_thumb’, 46, 60, TRUE); *no need to call function_exists for add_theme_support or add_image_size unless you want to be backwards compatible to pre 2.9.