• Resolved Aldo

    (@ab_lu)


    Hello

    For better styling we need to wrap i.e. paragraph blocks with a div or section tag.
    Is there any filter or easy way to automatically wrap a block in the front end view?

    Thanks
    Aldo

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Aldo

    (@ab_lu)

    Anybody?

    Thread Starter Aldo

    (@ab_lu)

    As content is saved i.e. with
    <!-- wp:paragraph --><p>Content</p><!-- /wp:paragraph -->

    Is there a filter to add a surrounding div before the content is rendered?

    Moderator Marius L. J.

    (@clorith)

    Hiya,

    You shouldn’t need to add wrappers to paragraphs, they are wrappers in and of them self, and you should instead target p tags based on the parent containers (often .content).

    If you still wish to though, you could still use the default the_content filter, set the priority so that it runs after blocks are converted to HTML and make sure you don’t run it anywhere other than the frontend to avoid warnings of modified content from Gutenberg.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wrap paragraph block with div’ is closed to new replies.