Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. <?php
  2. global $post;
  3.  
  4. if ( has_post_thumbnail() ) {
  5. // First retrive Image ID by Post ID from get_post_thumbnail_id()
  6. $attachment_id = get_post_thumbnail_id($post->ID);
  7. // Image url
  8. $image_url = wp_get_attachment_image_src($attachment_id,'full', false);
  9. // Alt text
  10. $image_alt = get_post_meta($attachment_id,'_wp_attachment_image_alt', true);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement