• Hi,

    I am using WordPress Core version 6.2
    I am converting an HTML template to a WordPress template

    I copy on the custom HTML blocks the 3 HTML codes relating to header, main content and footer

    When I copy then the blocks with the content inside, the HTML codes are not changed, they should display

    <!--/wp:html-->

    then I would have to paste each of the contents in the blocks in 3 separated template parts (one in header.html , the main content block into index.html and in footer.html)

    Why is the HTML custom block not behaving as expected?
    How do I fix it?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Unverified, but I don’t think you can nest other blocks within a custom HTML block. The block is intended for straight HTML, not block code. Furthermore, your HTML is still filtered. Non-compliant HTML according to WP kses() can cause the editor to complain about the content and offer to repair. Attempting to allow repair typically makes things worse IME.

    If you wish insert fully unfiltered HTML, assuming it is W3C compliant, it’s best to do so via shortcode or custom block.

    I understand the HTML you want to insert includes header, main content, and footer. If your theme template already implements its own header and footer, wouldn’t you then get 2 different headers and 2 different footers? Or do you have a template that has no header or footer parts? Not that it really matters, just curious.

    Thread Starter madleine

    (@madleine)

    @bcworkz I copied normal HTML code into the HTML custom blocks

    I am following a Udemy tutorial and the teacher is getting the normal HTML code converted after being put into the HTML custom blocks

    I need to move past this obstacle so I can move forward fast with the tutorial and complete it

    Can you help me?

    Moderator bcworkz

    (@bcworkz)

    If someone else is getting the same HTML to work on their site, but it doesn’t work on yours, it’s typically due to your particular theme or one of your plugins interfering. Try switching to a default Twenty* theme and deactivating all plugins. You should then get “normal” behavior. Once you succeed you may restore your normal theme and plugins. I suggest not attempting to further edit the HTML you managed to save this way until you can isolate exactly which module was the cause.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Not working HTML custom block in Gutenberg when copied for template parts’ is closed to new replies.