I had a reply from the wpforo people and the current dev version 6.8.05.003 shuold do it.
My filter adds ‘data-rel=”wppa”‘ (and the hourglass cursor) to tne <a>
tag so my lightbox knows it should act upon it:
// Add filter for the use of our lightbox implementation for non wppa+ images
add_filter( 'the_content', 'wppa_lightbox_global' );
// Add filter for wpForo posts
add_filter( 'wpforo_content_after', 'wppa_lightbox_global' );
function wppa_lightbox_global( $content ) {
if ( wppa_switch( 'lightbox_global' ) ) {
if ( wppa_opt( 'lightbox_name' ) == 'wppa' ) { // Our lightbox
if ( wppa_switch( 'lightbox_global_set' ) ) { // A set
$pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
$replacement = '<a$1href=$2$3.$4$5 data-rel="wppa[single]" style="'.' cursor:url('.wppa_get_imgdir().wppa_opt( 'magnifier' ).'),pointer;'.'"$6>';
$content = preg_replace($pattern, $replacement, $content);
}
else { // Not a set
$pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
$replacement = '<a$1href=$2$3.$4$5 data-rel="wppa" style="'.' cursor:url('.wppa_get_imgdir().wppa_opt( 'magnifier' ).'),pointer;'.'"$6>';
$content = preg_replace($pattern, $replacement, $content);
}
}
}
return $content;
}
I added add_filter( 'wpforo_content_after', 'wppa_lightbox_global' );
according to the directives from wpForo.
The js part of my lightbox tries to find the (wp) title and description according to your suggestion earlier:
// Initialize <a> tags with onclick and ontouchstart events to lightbox
function wppaInitOverlay() {
wppaConsoleLog( 'wppaInitOverlay' );
// First find subtitles for non-wppa images
jQuery( '.wp-caption' ).each( function() {
var div = jQuery( this );
var title = div.find( 'IMG[alt]' ).attr( 'alt' ) || '';
var description = div.find( '.wp-caption-text' ).html() || '';
var a = div.find( 'a' );
var lbtitle = title + '<br>' + description;
if ( ! a.attr( 'data-lbtitle' ) ) {
a.attr( 'data-lbtitle', lbtitle );
}
});
... etc
You may mail me at opajaap at opajaap dot nl (address spelled out to prevent spamming)