How-to and Troubleshooting
10
Posts
3
Users
0
Reactions
850
Views
9 Replies
Jul 22, 2022 5:08 pm
For ONE photo you need to add this to your theme's functions or with some other code snippet Wordpress plugin:
add_filter('wpforo_content_after', function( $content ){
return preg_replace_callback(
'#<a[^><]*\sclass=[\'\"](?\s[^\'\"]*)?[\'\"][^><]*\shref=[\'\"]([^\"\']+)[\'\"][^><]*>.*?</a>#isu',
function( $match ){
$html = $match[0];
$file = $match[1];
$pathinfo = pathinfo( $file );
if( wpforo_is_image($pathinfo['extension']) ) {
$html = sprintf(
'<a href="%1$s" target="_blank"><img class="wpforo-default-image-attachment" src="%1$s" alt="%2$s" title="%2$s"></a>',
esc_url($file),
esc_attr($pathinfo['basename'])
);
}
return $html;
},
$content
);
}, 11);
The above will embed the image in the body of post.
To open as a popup use ARI Soft
https://wordpress.org/plugins/ari-fancy-lightbox/
it is (imho) the best option.
For more than one photos and attachments in each post, you need to buy Advanced attachments plugin, from gvectors.
