Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

GenerateBlocks – style tags are missing on blog page

  • Hello Support-Team,

    I’ve recreated the issue on a fresh WordPress 6.5.3 installation.
    These are the changes I did:
    Theme installed: GeneratePress 3.4.0
    Modules activated: Blog and Spacing

    Plugins installed: GenerateBlocks 1.9.1, GenerateBlocks Pro 1.7.0, GP Premium 2.4.0 and Yoast Duplicate Post.

    GenerateBlocks Settings -> CSS PRINT METHOD -> Inline Embedding
    GenerateBlocks Settings

    Appearance Customize – Use infinite scroll
    Customizing Layout

    I’ve created 24 posts containing a grid, a container, an image and a more element. All IDs are unique.
    Container: GRID ITEM WIDTH (%) 50
    Image: HEIGHT 300px, OBJECT-FIT Contain

    create Post 1
    create Post 2
    create Post 3

    In blog mode, the styling for the first post (Test 24) is embedded in the header.
    first page Developer tools

    The style tags for posts 1-9 (Test 23-15) are embedded in the tags.
    Post Test 23 Developer tools

    the style tags for post 10/20 (Test 14/Test 4) are missing when infinite scroll is activated
    Post Test 14 Developer tools
    Post Test 4 Developer tools

    loading directly page 2/3 then Test 14/Test 4 is first on each page and the style tags are embedded in the header tag
    Page 2 Developer tools
    Page 3 Developer tools

  • Hi there,

    i am going to speak to Tom and the devs on this, as i its a peculiar one. Will reply asap.

  • GB renders local block styles on post render. It effectively parses the post for its blocks, extracts the block attributes and compiles the necessary CSS
    Part of this process includes where it should load the CSS as an inline <style>, which it does IF there is very little CSS on the post.

    But its not built for parsing inside the loop, i assume its working to some degree because of the way WP generates the post excerpt when using the MORE TAG. But i would have expected this to fail entirely and not just the first post of each pagination load.

    What is it you’re trying to achieve in the loop ?

  • I don’t use any loop. I just enabled infinite scroll on the theme.

  • Sorry what i meant by the loop is your blog / index / archive pages.

  • Try adding this PHP Snippet to the site:

    add_filter( 'generateblocks_do_inline_styles', function( $do ) {
        if ( is_archive() ) { // For example.
            return true;
        return $do;
    } );

    This will force GB into using inline styles on the archive.
    But… we are still not sure this will work with infinite scroll

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