AI Search
Classic Search
Notifications
Clear all
2 Replies
Apr 09, 2020 12:49 pm
You may try this code, add it to your themes function.
add_filter('wpforo_content_after', 'wpforo_default_attachment_image_embed', 11);
function wpforo_default_attachment_image_embed($content)
{
if (preg_match_all('|<a class=\"wpforo\-default\-attachment\" href\=\"([^\"\']+)\"[^><]*>.+?<\/a>|is', $content, $data, PREG_SET_ORDER)) {
foreach ($data as $array) {
if (isset($array[1])) {
$file = $array[1];
$e = strtolower(substr(strrchr($file, '.'), 1));
if ($e == 'jpg' || $e == 'jpeg' || $e == 'png' || $e == 'gif') {
$filename = explode('/', $file);
$filename = end($filename);
$html = '<a href="' . esc_url($file) . '" target="_blank"><img class="wpforo-default-image-attachment" src="' . esc_url($file) . '" alt="' . esc_attr($filename) . '" title="' . esc_attr($filename) . '" /></a>';
$content = str_replace($array[0], $html, $content);
}
}
}
}
return $content;
}
Apr 09, 2020 5:22 pm
Hi @good999,
Please try to use the code provided above.
Please let us know, are the media files stored on Amazon s3, when you use the wpforo default attachment?
Also please leave the example URL to allow us to check it.
