Advertisement
Guest User

media tag

a guest
Oct 10th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2. $media_items = get_attachments_by_media_tags('media_tags=$tag-name&size=thumb');
  3. if ($media_items) {
  4. echo '<ul>';
  5. foreach ($media_items as $mymedia) {
  6. $fullSize = wp_get_attachment_url($mymedia->ID);
  7. $thumbnail = wp_get_attachment_thumb_url($mymedia->ID, 'thumb');
  8. echo '<li><a href="' . $fullSize . '" rel="shadowbox[set1]" title="Fullscreen" ><img src="'.$thumbnail.'" /></a>
  9. <span>This photo belongs to post: <a href="/summer-holiday">Summer holiday</a>, <a href="/best-of-2012">Best of 2012</a></span>
  10. </li>'; }
  11. echo '</ul>'; } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement