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 WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

New global styles functionality

  • Hi,

    I don’t really understand the “why” and “how” of this new global styles functionality that is now in public testing.

    With the legacy global styles functionality, I had one kind of ‘global’ setting and I was able to override it whenever I wanted to. Now, it seems that all used global styles need to have equal markup, since I don’t have a place where to “store” the global option? From the global styles settings page, the only possibility I have is viewing the css, changing the global styles order or set a global style in publish or draft (for whatever reason this may be interesting).

    Another thing.
    On this help page, it is described that you need to manually migrate all old global styles and there is no automated way of doing this. In my opinion, changes to the page builder of theme options, should always enable the user to do automated migrations, instead of creating a lot of manual work.

    The argument “you can stick with the legacy option” is invalid, since it’s called legacy, which means it will not be supported in the future or will not have the new features this new global function will have.

    I know this is still in beta, which is the reason I am providing this feedback. Maybe I’m wrong at some points, for which clarification is appreciated, not only via this topic but maybe also within the help documentation itself.

  • Hi there,

    In GB Pro 1.7 – new global styles is completely decoupled from the block and the need for a specific admin screen in which to create and edit them.

    Instead GB Pro 1.7 global styles can be created and edited from any block editor screen.
    Simply select a block and add a new global style or select a block that has the global style class attached to it and edit that style. Theres no longer a need to leave the page you’re editing to create or edit a global style.

    If you wish to maintain a similar system to legacy global styles, then i suggest creating local Patterns or a styles book page to create an overview of them.

    Your thoughts and feedback on this are much appreciated.

    Legacy styles, there is no need to abandon them, and we will continue support for them. Will they be able to handle all the new features that the new styles object brings? Most probably not.

    Migrating existing styles; as much as we would like to make this possible it would mean either manipulating the client site database ( which we don’t like doing ) or severely limiting the new styles object.

  • I’m unclear about something here.

    I run a site that’s fundamentally based on Global Styles that are reflected in Local Patterns, which have been inserted in the content of so many posts and pages that the idea of migrating manually sounds labour intensive.

    Especially when reading this line from the documentation:

    You can keep this class name, or you can create a new one. It doesn’t matter, as you will need to manually add the new class to your existing blocks.

    Does that really mean manually revising the classes of each block, across the board?

    Say that a Local Pattern defined by Global Styles has been used 200 times on a site and that there are 14 blocks inside it – mainly Containers and Headlines to create a very specific layout. Having to update each block for a grand total of 2,800… is very tedious if someone wants to abandon the legacy Global Styles.

    I understand that there’s no obligation to update but it makes using the new features a daunting prospect for anyone with a certain amount of existing content.

  • Hi there,

    The new Global Style class system applies only to newly created styles. Your existing global styles created before GB 1.9 and GB Pro 1.7 remain unchanged. They will continue to function as they do now, allowing you to edit one block in the global styles and apply changes across the entire site where the global style is used.

    Therefore, you don’t need to be concerned about migrating to the new global styles or it affecting your existing legacy global styles. These are separate systems that do not interfere with each other.

  • I understand that existing Global Styles remain intact, but the reply doesn’t address my question.

    I’m asking “what if people’s Global Styles and Local Patterns have generated hundreds – or thousands – of blocks across a site and they want to migrate?”

    If you’ve used Local Patterns to insert customised blocks and responsive tables within posts and pages, a manual migration can mean updating thousands of blocks, one by one. This effectively puts the bar very high to use the new Global Styles system.

    Without either automation or a feature that allows to update all the blocks related to a ‘legacy’ style in one shot, the task becomes overwhelming.

  • I’m asking “what if people’s Global Styles and Local Patterns have generated hundreds – or thousands – of blocks across a site and they want to migrate?”

    Unless there is some real significant benefit of switching to the new system than i would say do NOT migrate, particularly where you already have a well established and complex workflow.

    If there were a benefit worthy of switching then you can do it as piecemeal process.
    That process is:

    1, Creating New Global Styles from Legacy styles
    See here how to do that:

    https://docs.generateblocks.com/article/migrating-from-legacy-global-styles/

    It is key that the new global style class name is an exact match of the legacy

    Once completed for all global styles GB will load the new global styles sheet.

    2. disable the legacy styles by quick editing them all and changing their status to Draft.

    3. edit blocks and swap to new styles at your leisure*

    * you can do this whenever you feel the need to. The reason for this, is the legacy global style field will still be set on each block and this adds the classname attribute to the blocks HTML, and this block will now attract the styles loaded in the new global styles.

  • Thanks for that explanation, David.

    Just trying to understand one last detail based on this:

    It is key that the new global style class name is an exact match of the legacy

    Once completed for all global styles GB will load the new global styles sheet.

    Let’s say that I currently have a legacy style defined and that it’s used in 10 blocks across the site. If the class name of the new style is an exact match – the 10 blocks will use it without being manually edited?

    If that were the case, it would save plenty of individual edits.

  • Thats correct.
    For more detail:
    All blocks with a legacy global style get attributed with a CSS Classname.
    The classname is the name given to the global style. eg. gb-button-primary-style
    And that class will remain attached to the blocks HTML until you remove the legacy style from that block.

    Your new global style using the exact same name eg. gb-button-primary-style will write the CSS for that class. So those styles will also get applied to that block.

  • Thank you. That’s what I was hoping for 😀

  • You’re welcome

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