How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?

You should take a look at your Media Settings, to define the dimensions of your post thumbnails. Additionally, you could add this code to your functions.php to specify your own thumbnails and dimensions: // add thumbnail theme support add_action(‘after_setup_theme’,’tjnz_theme_support’); function tjnz_theme_support() { add_theme_support(‘post-thumbnails’); // wp thumbnails set_post_thumbnail_size(170, 170, true); // default thumb size add_theme_support(‘automatic-feed-links’); // … Read more

Fancybox just loading small white square

Use Firebug with Firefox, or use the developer tools in Chrome or Safari or IE to see what’s loading on your site; there’s 404 for a JS file called main.js, probably from Fancybox. Your main jQuery libraries are loading OK.

How to use getimagesize() of image upload?

In this part: getimagesize($path.”https://wordpress.stackexchange.com/”.$_POST[‘name’]); the variable $path is an array. Try to use getimagesize($path[‘path’].”https://wordpress.stackexchange.com/”.$_POST[‘name’]); instead.

WordPress keeps resizing my 947×947 image down to 500×500 (full-size option)

I figured it out. The hint from user29296 is what led me to this: I had to insert the image using CSS, not html. Check the page now: http://macaulay.cuny.edu/eportfolios/menatwork/test-page/ The code was this: <style type=”text/css”> #image { position:absolute; width:947px !important; height:947px; background-image:url(‘http://macaulay.cuny.edu/eportfolios/menatwork/files/2013/05/test.jpg’); background-repeat:no-repeat; } </style> <div id=”image”></div> Thanks for the replies!

Get Original Dimension Featured Image on the homepage

The second parameter for wp_get_attachment_image_src is $size. $size (string/array) (optional) Size of the image shown for an image attachment: either a string keyword (thumbnail, medium, large or full) or a 2-item array representing width and height in pixels, e.g. array(32,32). As of Version 2.5, this parameter does not affect the size of media icons, which … Read more

Convert featured images into “product images”

That sounds weird because post thumbnails were changed to Featured Images with WP 3.0. I guess you’re talking about some custom field or metabox your framework adds on post edit. You could grab _thumbnail_id which is the key in the wp_postmeta table that stores what you’re looking for. But to me you’d better usewp_get_attachment_img_src: if(has_post_thumbnail($post->ID)) … Read more

Simple Local Avatar Plugin

The get_avatar function is pluggable, meaning that you can define a function of your own having that name and completely overwrite the default function. If you look at the source for the “Simple Local Avatars” plugin, that is exactly what it has done. get_avatar in your code should be using the function defined by “Simple … Read more

How to get the cropped image from media library?

Get the attachment ID for the image, then get the post meta field _wp_attachment_metadata for it. This is a serialized array. The field sizes in that array contains all available image sizes. Pseudo-code: $sizes = array(); $attachment_url=”http://examle.com/wp-content-uploads/foo.png”; $attachment_dir = dirname( $attachment_url ); $attachment_id = get_attachment_id( $attachment_url ); $attachment_meta = get_post_meta( $attachment_id, ‘_wp_attachment_metadata’, TRUE ); $sizes[] … Read more

How to add “alt” attribute for image during upload at WP front-end?

The alt text is stored in the postmeta database table by WordPress, therefore we have to update the postmeta of the given attachment. The reference is done via the unique attachment ID, and the meta_key we are targeting is the _wp_attachment_image_alt. So, to set the alt text, we can do the following: update_post_meta($attach_id, ‘_wp_attachment_image_alt’, ‘Your … Read more