This would be a good solution if one would actually add the image to the post, but in my case, I don't do that.
I've programmatically added the attached images of the post/page you're viewing to a slideshow in the header of my template, by using this code:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
echo "<div class=\"slide_item\">";
echo apply_filters('the_title', false);
the_attachment_link($attachment->ID, true);
echo "</div>";
echo "";
}
} else {
?>
<a href="<?php bloginfo('url'); ?>"><img src="<?php bloginfo('template_url'); ?>/images/defaultimage.jpg" alt="" title="" /></a>
<?php } ?>
<?php endwhile; else: ?>
<!-- no images found //-->
<?php endif; ?>
The -quite excellent- trick with this is that the webmaster can just upload a couple of images to the post/page, hit 'save changes' and the code does the rest...
but, when viewing the slideshow in my browser, the manually added link is not saved. I also noticed this link is not stored in the database, which is quite a PITA since I really need that feature.
Would there be any workaround for this? It would save my day :) Thnx for any assistance!