If you want to adjust the HTML of a Core block, one option is to add a filter on the render_block
hook. This allows you to use PHP to modify the HTML output, so you don’t have to set up a whole Webpack setup and use newer JS. If you place this in the (child) theme, this will also allow the site owner to automatically swap back to normal Gallery block markup if they switch themes, so non-Bootstrap themes won’t break the block.
The downside is, the filter runs after WordPress has already retrieved the content, so you’re looking at slightly longer processing times of the final markup. This shouldn’t be too big of an issue for most sites, especially if you have some kind of caching set up.
You can find documentation on render_block
on the WP Developer site.
Related Posts:
- Add colors to existing color palette without replacing it
- Gutenberg – editor-font-sizes in functions not working
- create-guten-block in wordpress theme?
- Correct way to make a custom block theme responsive
- Full site editing templates folder vs block-templates
- Sizing screenshot.png without losing aspect ratio
- How to add CSS class to custom logo?
- Should `get_template_directory_uri()` be escaped?
- How To Add New Option Types To Option Tree?
- Page template in two level deep folder
- Child Theme not loading parent CSS
- What can I hook into after_setup_theme?
- Where do I find the functions triggered within a hook?
- Use of undefined constant FS_CHMOD_DIR – assumed ‘FS_CHMOD_DIR’
- Registering Sidebars and Sidebar Widgets. Sidebar Widgets Not Displaying
- How do I get a parent theme modification from a child theme?
- Removing the default sidebar from admin panel
- how to pull wordpress post comments to a external page
- index.php is not loaded for single posts
- Why use while over if in single wordpress posts?
- WordPress website loads but is not displayed until page scrolled
- How to use bloginfo( ‘template_directory’ ) in array
- Different Admin Theme – Based on Role?
- Theme Customizer not loading
- Is it a good idea to make whole theme widgetized?
- Single Theme folder for Multiple WordPress
- Gutenberg Reusable Block as part of WordPress Theme page
- How i can get widgets areas working in customizer?
- Cutomize Colors utility: How to add more configurable colors to a theme
- Where is definied the theme location for the main menu in a WordPress template?
- How to disable automatic colors in the Twenty Twenty theme?
- Cannot figure out how to overwrite files in child theme
- WordPress post arrangement using post_class
- Customize the previous_post_link output
- How to use get_template_part instead of include_once?
- How to remove comment link title attribute?
- Translation Issue with WordPress Theme Check in comment_form function
- Which file handles the block latest posts, I want to examine excerpt handling
- wp-cli: For development, how can I activate a theme that is on the local disk but not zipped?
- My Admin bar covers my sticky navbar [closed]
- Using esc_url with a hard coded url
- Broken template went invisible
- Single Page Design, Storing in Theme Options
- Not able to select width of blocks inside of cover block
- Edit footer via customizer
- gutenberg add classes to list items
- loading blank white screen of slide
- Child Theme’s style.css not loading in mobile browser
- Migrated WordPress site renders Chinese
- How to Find the Page the Front Page is Using?
- How do I get the trackback count of a post in wordpress without writing an SQL query?
- WordPress 3.8 Backend Admin Color Scheme add more scheme how to do?
- 3 Level Deep Navigation Menu Not Showing All Levels
- How to change the theme directory uri for localhost?
- How to Have a Pure HTML Sub Directory In WP Site
- Theming Using Bootstrap Glyphicons and WordPress Dashicons
- featured content: which area does this cover [closed]
- WordPress page/blog incorporated into static website
- Random white space before doctype
- How to add menù section to my WordPress template?
- What are the critical theme files when building a custom theme?
- Having issue with WordPress wp_enqueue_style
- Starting point for custom Themes [closed]
- Theme Development -> Specific Homepage
- Which cache is kicking
- Customizer: get_preview_url() inside customize_save_after hook
- Is there a way to switch to another theme?
- How add built-in textarea in theme development?
- Filter didn’t work on content class (hybrid_post_attributes)
- Post archives link yields a 404 Not Found
- Trying to link to a php template file but its blank
- Let user to upload multiple time
- How to diagnose wp-env environment problem
- WP Gutenberg custom block – generate theme colors from SASS and use them in the inspector and php callback
- Block validation failed for `core/pullquote` after adding theme support for editor-color-palette
- How to make menus, footer, sidebars multi language
- Different WP Rest API custom endpoints across different themes
- register_theme_directory() sees custom themes directory, but blank frontend
- hide/show a div in wordpress
- How one category can have different fields?
- How to create multiple pages in a client theme?
- How do child themes work?
- Using Customizer value in an external PHP file inside a theme
- Import from HubSpot COS into WordPress 4?
- Theme customizer live preview JS- Trying to bind to an html image url without luck
- Theme automatically inserting “more” tag on every post
- How get the 10 most viewed pages (not post)
- adding navigation to genesis themes
- Using wp_enqueue_script with social media buttons?
- Show post thumbnail only if it exists using timthumb
- Purchased Theme to Custom Made Theme? [closed]
- How to make website with many template that active [closed]
- Image Size wrong during upload
- How to create full header but keep content narrow
- Is there a block to print post link standalone in a block theme?
- How to make a multilingual wordpress site to be translated one-to-one without much effort and without using translate?
- Is there a way to have WordPress autodetect page templates in the page-templates directory and any sub-folders?
- My wordpress site memory exhausted more than 1GB trying to debug with default
- How can I use pre declared blocks in a php file?
- Image and font support missing in editor when deploying theme remotely