Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $post;
- if ( has_post_thumbnail() ) {
- // First retrive Image ID by Post ID from get_post_thumbnail_id()
- $attachment_id = get_post_thumbnail_id($post->ID);
- // Image url
- $image_url = wp_get_attachment_image_src($attachment_id,'full', false);
- // Alt text
- $image_alt = get_post_meta($attachment_id,'_wp_attachment_image_alt', true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement