• Resolved RPittam

    (@rpittam)


    This single image has been added by a Spectra Image gallery – in this case with just a single image. I select Tiled layout and save it – it displays as you can see correctly on the above link. However, when i open the page to edit some content, the image gallery keeps reverting to a grid layout, as it must look and see there are less than 4 images, so the image wouls show massive taking up most of the page. If i rememeber to check the image as Tiled, before i save my changes – all is well. However, this is a real pain and i often forget, then have to popen and edit and check it as tiled again, then save again. I have looked at some modifications in the Additional CSS to try and make it stay as tiled. I even asked ChatGPT, which suggested some <php>snippet code to run on pages, to try and make it change/render as Tiled layout – see code below. This did not work sadly. Do you have any answers? Can I set the tiled layout to stay as it should, no matter how many images are in the gallery block 5,4,3,2, or even just the 1 ? Thanks. Richard.

    // Modify Spectra Image Gallery block to enforce tiled mode during rendering
    add_filter(‘render_block’, ‘force_tile_mode_on_render_specific’, 10, 2);

    function force_tile_mode_on_render_specific($block_content, $block) {
    // Check if the block is a Spectra image gallery block
    if (isset($block[‘blockName’]) && $block[‘blockName’] === ‘uagb/image-gallery’) {
    // Force the feedLayout attribute to be “tiled”
    if (isset($block[‘attrs’]) && isset($block[‘attrs’][‘feedLayout’])) {
    $block[‘attrs’][‘feedLayout’] = ’tiled’; // Enforce tiled layout
    }

        // Ensure that the block has the correct class or ID
        if (strpos($block_content, 'uagb-block-7a613e15') !== false || strpos($block_content, 'wp-block-uagb-image-gallery') !== false) {
            // Re-render the block with the modified attributes
            $block_content = render_block($block);
        }
    }
    
    return $block_content;

    }

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support mohsinbsf

    (@mohsinbsf)

    Hi @rpittam,

    Thanks for getting in touch with us.

    I have tested the tiled option and it is working fine, here is the reference video: https://d.pr/v/mbahkd

    Please let me know the missing steps so that I can assist you.

    Have a nice day!

    Thread Starter RPittam

    (@rpittam)

    thanks for the video. When I have 4 images set it to tile then view it is fine. Then when I re-edit it looks ok except that it has changed to grid, which doesn’t look much different than tiled with 4 columns, just a bit larger thumbnails. However, when I add just 1 or 2 images then because I don’t want them to take up too much space on the page, I set the gallery to Tiled, which by design sets to 4 columns. The thumbnails are small but that’s what I want. Save it, then view it, looks nice. Then when I re-edit it the gallery has reverted to grid and in this case 2 columns, but the images are unaligned and large. I have to click one of the images which then resets it to Tiled – yes it’s weird but that’s what happens. Then I resave it and it looks fine again. This edit issue and the need to click a thumbnail to reset it is not the end of the world, but it’s a pain, as I have ACF custom fields I maintain for the page, so edit access is a regular occurrence. Don’t know what’s going on here. Oh, forgot, I also set the gallery to run Fancyboc on click event. I wish I could video it so I could show you. Presumably it’s because I am using less than 4 images and setting the gallery to Tiled, which sets columns to 4 and left justifies the thumbnails. Anyway that’s what happens on my Astra themed pages.

    thanks. Richard

    Thread Starter RPittam

    (@rpittam)

    Made a little video – hope it explains my issues.

    https://youtu.be/q5q0DkxG1sU

    Plugin Support mohsinbsf

    (@mohsinbsf)

    Hi @rpittam,

    Sorry for the inconvenience caused to you.

    I am not able to replicate the issue on my installation. I request you open a support ticket from here:https://wpspectra.com/support/ so that our support dev can check your site configuration and assist you accordingly.

    Have a nice day!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.