How do you get the post thumbnail size?

When an image size is added either by WordPress(add_image_size), or by a plugin or your own custom code it gets added into the $_wp_additional_image_sizes global, i can’t find a similar function for pulling data from that global, but you could certainly just look inside the global to determine what width and height a registered image … Read more

How do you remove hard coded thumbnail image dimensions?

Related: Filter to remove image dimension attributes? There’s a filter on post_thumbnail_html which receives as its argument the full html element representing the post thumbnail image before it’s echoed to the page. You can filter out the dimensions with a bit of regex: add_filter( ‘post_thumbnail_html’, ‘remove_thumbnail_dimensions’, 10, 3 ); function remove_thumbnail_dimensions( $html, $post_id, $post_image_id ) … Read more

How to set featured image to custom post from outside programmatically

Can’t this simply be done with media_sideload_image() ? Seems pretty simple. Only catch is if you aren’t on admin area, you must include some libraries from within WordPress includes: // only need these if performing outside of admin environment require_once(ABSPATH . ‘wp-admin/includes/media.php’); require_once(ABSPATH . ‘wp-admin/includes/file.php’); require_once(ABSPATH . ‘wp-admin/includes/image.php’); // example image $image=”http://example.com/logo.png”; // magic sideload … Read more

How to disable WordPress from creating thumbnails?

To built on Max Yudin’s answer you should use the intermediate_image_sizes_advanced filter, and not image_size_names_choose. Add to functions.php function add_image_insert_override($sizes){ unset( $sizes[‘thumbnail’]); unset( $sizes[‘medium’]); unset( $sizes[‘large’]); return $sizes; } add_filter(‘intermediate_image_sizes_advanced’, ‘add_image_insert_override’ ); Another easier option I think works is going to your Settings–>Media and setting each box for width and height to 0

Add class name to post thumbnail

Yep – you can pass the class you want to use to the_post_thumbnail() as part of the attributes argument, for example <?php the_post_thumbnail(‘thumbnail’, array(‘class’ => ‘your-class-name’)); ?> Ref: http://codex.wordpress.org/Function_Reference/the_post_thumbnail#Styling_Post_Thumbnails

How to Fix HTTP Error When Uploading Images?

I put the following code into my functions.php file. It works! add_filter( ‘wp_image_editors’, ‘change_graphic_lib’ ); function change_graphic_lib($array) { return array( ‘WP_Image_Editor_GD’, ‘WP_Image_Editor_Imagick’ ); } When this helps it is because it changes the PHP code module used for processing the uploaded image for use with WordPress. This processing includes moving the image into the media … Read more

How do I get image url only on the_post_thumbnail

You might also try: If you only have one size thumbnail: $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ) ); Or…if you have multiple sizes: $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), “size” ); Note that wp_get_attachment_image_src() returns an array: url, width, height, is_intermediate. So if you just want only the image url: echo $thumbnail[0]; Resources: http://wpcanyon.com/tipsandtricks/get-the-src-attribute-from-wordpress-post-thumbnail/ https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)