[Support request] Automate grid type of setup in GP Premium or GB

Home Forums Support [Support request] Automate grid type of setup in GP Premium or GB

Home Forums Support Automate grid type of setup in GP Premium or GB

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1598389
    Randy

    What would be the best way to automate the creation / populating lots of grids on a page.

    For example, let’s say there’s a grid for each U.S. State, and it will be populated in a way that there is a consistent filename, title, url etc that can be automated to populate the grid. But I want to leverage a nice looking grid like in GB/GP Premium without having to manually set up all 50 grids on each page where I want to do this.

    Suggestions on how to approach that with GB/GP?

    Thanks!

    #1598435
    David
    Staff
    Customer Support

    Hi there,

    how is the content created for each of these ‘grids’ ? Do they have an individual post attached to them or are they just static content ?

    #1598436
    David
    Staff
    Customer Support

    Hi there,

    how is the content created for each of these ‘grids’ ? Do they have an individual post attached to them or are they just static content ?

    #1598452
    Randy

    It will be just static content in each grid unit, for example an <a href link, an <img src=, and maybe a caption. Very simple static content where the behind the scenes href and img src naming is consistent and so can be automated to populate the grid unit.
    Thanks!

    #1598462
    David
    Staff
    Customer Support

    You could create you first grid template, save it as Reusable Block. The reusable block can then be added to new pages, and converted to a regular block so you can update the URLs etc….. but its still very manual, but at least you can set the styling etc for the grid only once.

    #1598643
    Randy

    Hmm…I see what you mean. Is there a way to HOOK into a GB (or reusable block) on page load and just repeatedly add the same block, modifying a few things along the way (e.g. url, img src etc)?

    #1599040
    Elvin
    Staff
    Customer Support

    Hi,

    If I may suggest:

    It may be best to just get a plugin that displays grid loop dynamically from your “US state” instead of trying to create a “bot” for Gutenberg that inserts a Grid Block for each “US state” as this will cost you significant amount of time and development resources with no guarantee of success plus you’re adding more things to worry about because you have to maintain it and make sure it works every time WordPress or the plugin updates.

    With what you’re trying to do, the most applicable thing seems to do would be:

    1.) Use Pods or CPT to create a custom post type with its proper fields (img, description, state name, population, etc).

    2.) Create post for each US state under its own custom post type.

    3.) Display these post as a grid with a plugin like WP Show Posts or a custom shortcode that specifically renders a grid loop.

    4.) Modify how it looks with CSS.

    While I completely understand why you want to do this(GB is great for styling), Gutenberg editor, or GenerateBlocks, isn’t created for this kind of process.

    A wise man once said:
    "Have you cleared your cache?"

    #1599392
    Randy

    Some interesting thoughts Elvin, thank you. I’d really rather not add more plugins to the site…I’d rather keep it lightweight if at all possible.

    It seems that your Block Element with Hooks is very close to what I need, if I were able to add a loop to repeatedly add a Block Element to the page content (e.g. one for each state), just using php str_replace to replace the content in each Block Element as it’s added in a loop.

    That would be awesome to be able to do that with GP/GB Block hooks.

    #1599603
    David
    Staff
    Customer Support

    This really sounds like the best solution is what Elvin offered.
    You may just want to create a CPT and a custom Archive template. Then those ‘pages’ will be automatically generated.
    If you need to add the post grids to a static page then the WP Show Posts plugin is the way to go.

    We have some plans for dealing with dynamic data in GPP and GB in the future, and WPSP will also get ‘blockified’. But until then the method above is the way to go – and even when that does occur you will still need a CPT for this kind of functionality.

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