Hello,
First of all this is a damn great plugin! Great work and keep it up!
Just to clarify, as I think this post was resolved but the solution not clear to everybody. I modified the template-tags.php file located in the library directory of the user-submitted-posts plugin directly.
The following works perfectly, with one or multiple images to display in a “slideshow” using WP Lightbox 2 (another great plugin). Here are the changes (included between FIX and EOF, basically a miserable one line addition + a change in the returned string of the echo call:
function usp_post_attachments($size = 'full', $beforeUrl = '<img src="', $afterUrl = '" />', $numberImages = false, $postId = false) {
if (false === $postId) {
global $post;
$postId = $post->ID;
}
/*if (!in_array($size, array('thumbnail', 'medium', 'large', 'full'))) {
$size = 'full';
}*/
if (false === $numberImages || !is_numeric($numberImages)) {
$numberImages = 99;
}
$attachments = get_posts(array('post_type'=>'attachment', 'post_parent'=>$postId, 'post_status'=>'inherit', 'numberposts'=>$numberImages));
foreach ($attachments as $attachment) {
// FIX for supporting LightBox with WP-LightBox 2
$info = wp_get_attachment_image_src($attachment->ID, $size);
$lightBoxedUrl = wp_get_attachment_image_src($attachment->ID, 'large');
echo '<a href="' . $lightBoxedUrl[0] . '" rel="lightbox[uspgallery]">' . $beforeUrl . $info[0] . $afterUrl . '</a>';
// EOF
}
}
I don’t like to modify plugins code directly, for obvious plugins upgrade reasons, therefore, a “clean” way, more painful though would be to actually create a function in your theme to deal with this, but for the purpose of the site I am working on, it’s far enough and works as expected 100%.
Jeff, I suggest you an option for lightbox support to usp_post_attachments() given lightbox is widely used everywhere.
Keep the good work up!
Cheers,
RaPhiuS