投稿に添付された画像を表示する次のコードがあります。
<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID,
'exclude' => get_post_thumbnail_id()
);
$attachments = get_posts( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
echo '<a href="';
echo wp_get_attachment_url( $attachment->ID );
echo '" rel="lightbox">';
echo wp_get_attachment_image( $attachment->ID, 'large' );
echo '</a>';
}
}
?>
しかし、ライトボックスが機能しない理由がわかりません! colorbox、shadowbox、ligthbox プラグインなどを試しましたが、ロードされません。画像をクリックすると、ページが開きます。
私は何を間違っていますか?