• Hi,
    I’m using a custom image size
    add_image_size( 'index-thumb', 0, 125, true );

    How do I get the width of the generated image?
    <?php the_post_thumbnail('index-thumb'); ?>
    $width = ???

Viewing 1 replies (of 1 total)
  • Thread Starter charleyramm

    (@charleyramm)

    $id = get_post_thumbnail_id();
    $meta = wp_get_attachment_metadata($id);
    $width = $meta['sizes']['index-thumb']['width'];
Viewing 1 replies (of 1 total)
  • The topic ‘get_the_post_thumbnail(array(0,100)) — How do I find out the image width?’ is closed to new replies.