Hello, I have added the code below to show last N images in member’s header, but when I click on a thumbnail it takes me to the user’s media’s permalink instead of displaying the lightbox.
How can I display the lightbox ?
Thanks a lot, Marine
add_action( 'bp_after_member_header', 'show_last_n_images', 99 );
function show_last_n_images() {
$n = 5;
if( $user_id = bp_displayed_user_id() ) {
$model = new RTMediaModel();
$results = $model->get( array( 'media_type' => 'photo', 'media_author' => $user_id ), 0, $n );
if( $results ) {?>
<ul>
<?php foreach( $results as $image ) { ?>
<li>
<div class="rtmedia-media" id="rtmedia-media-<?php echo $image->id; ?>">
<a href="<?php echo get_rtmedia_permalink( $image->id ); ?>" title="<?php echo $image->media_title; ?>">
<img src="<?php rtmedia_image( "rt_media_thumbnail", $image->id ); ?>" alt="<?php echo rtmedia_image_alt( $image->id );?>" />
</a>
</div>
</li>
<?php } ?>
</ul>
<?php
}
}
}