Forums
Home / Fixing WordPress / how an i echo just the id of an attachment?
(@dynamitharry)
13 years, 8 months ago
hello!
the question is:
how an i echo just the id of an attachment?
i hope for an answer because right now im stuck..!
(@greuben)
$attachments =& get_children('post_type=attachment'); foreach($attachments as $id=>$attachment){ echo $id; }
Thanks!
But i dont think it works for me..
I list a lot of attachments from several post in my category.php.. every post got at least three attachments.. now when i put it in i just get the same attachment id on everything.
the reason why i need unique id’s is because i use quicksand to filter my attachments..
Take a look at this. http://codex.wordpress.org/Template_Tags/get_posts#Show_all_attachments