oh and the images work, but they link to the image itself and that’s it.
Are you sure the images are showing with their links? Your PHP code did not work with me, I had to use this instead:
$attachments = get_posts( array(
'post_type' => 'attachment',
'post_mime_type'=>'image',
'posts_per_page' => -1,
'post_status' => 'any',
'post_parent' => $post->ID);
);
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
$src = wp_get_attachment_image_src( $attachment->ID, full);
$html="<a href="".$src[0].'">';
$html .= wp_get_attachment_image( $attachment->ID, 'gallery-thumb') .'</a>';
echo $html;
}
}
In case your PHP is working just fine, go ahead and try one of the following:
- Remove your Lightbox wp_enqueue_script from your PHP function (possible conflict with Fancybox).
- If step 1 still didn’t work, check which version of Fancybox you are using and Google if it’s working with your current WordPress version.
I got Fancybox working on the attachments using the PHP code above with your JS code and a simple wp_enqueue_script for Fancybox. I’m using the following: