Post Grid does not show images when using Site Builder to create the post with
-
Hi
I am a happy user of Post Grid, but have a problem with images not shown
My posts and pages are build with Site Origin Builder
If an image is within a widget then it is not shown in the Grid.
If the image is within a text block then it is shown in the Grid.
I have investigated the behavior and found the reason for it.
Site Builder Origin puts special characters into the page aroung images
Those characters need to be removed before Post Grid can find the image
So I altered the code in \includes\function.php
// Start modification Peter Smits 28-11-2019
//$post_content = $post->post_content;
$post_content = htmlspecialchars_decode($post->post_content); // Special characters are not needed !!
$first_img = ”;
ob_start();
ob_end_clean();
$output = str_replace( array( ‘\/’ ), “\\” ,$post_content); //filter the extra slashes out placed by Site Origin Builder
$output = str_replace( array( ‘src=\\’ ), ‘src=’,$output); // filter the extra slashes out placed by Site Origin Builder
$output = preg_match_all(‘/<img.+?src=[\'”]([^\'”]+)[\'”].*>/i’, $output, $matches);
if(!empty($matches[1][0])){
$first_img = $matches[1][0];
// Remove the extra slash at the end if present
if ($first_img[strlen($first_img) – 1] == ‘\\’){
$first_img=substr($first_img,0, -1) ;
}
// End modification Peter Smits 28-11-2019After that I get my images within the grid.
This code is not perfect it could possibly be improved
But I would very much like this change within the next official release
Regards,
Peter
- The topic ‘Post Grid does not show images when using Site Builder to create the post with’ is closed to new replies.