PHP Code snippet execution error
-
Hi
I am not sure if the issue is directly related to GP or not and whether I should be putting up this query in this forum. I have recently installed WPFORO forum plugin and everything works fine with GP theme. However, I am facing issues in executing a particular PHP code snippet. I am using Code Snippets and GP Child Themeadd_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; }
Link: https://wpforo.com/community/how-to-and-troubleshooting-2/uploading-and-embedding-images/
I got in touch with WPForo Support and they have replied that the code works fine at their end.
Screenshots:
https://prnt.sc/nz4ezp
https://prnt.sc/nz4f4aWarmest Regards
BMThe page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘PHP Code snippet execution error’ is closed to new replies.