How to echo the url of an attachment?
-
Hi everyone,
What’s the best way to print the url for an attachment that uses the large format? I’ve tried
wp_get_attachment_image_src
and it returns an array? This is what I’m using to get the first attachment image.<?php $attachments = get_children(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order')); if ( ! is_array($attachments) ) continue; $count = count($attachments); $first_attachment = array_shift($attachments); ?>
Thanks,
Gregory S.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to echo the url of an attachment?’ is closed to new replies.