• Resolved sprowt

    (@sprowt)


    hi.. i’m embarrassed to post this but i don’t know what else to do.

    when i add any content to a required header.php file at '/inc/structure/header.php' the <head> element content gets jumbled (corrupted?).

    the <head> content moves to below the <body> tag and the customizer acts odd–i can’t browse to change themes (shows 0 themes to browse).

    it doesn’t happen until i add content (not just when i require a file). i’ve copied and pasted other code so i know it’s not a typo.

    it happened before WP 5.6 release.

    i’m trying to follow some GP structure and include code i learn from there, but this is totally bizarre to me.

    i just got started so it’s an empty blank theme and a fresh WP install–have wp_head() and wp_footer() calls but it’s bare bones besides that.

    so sorry for the dumb Q. i’m using Local by Flywheel.

    i’m just baffled and really disappointed in myself tbo :/

    thanks, L <3

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    so sorry for the dumb Q. i’m using Local by Flywheel.

    i’m just baffled and really disappointed in myself tbo :/

    Don’t be. This is actually pretty advanced stuff for most users as most them only deal with what’s within the UI. ??

    Reminder: We don’t recommend editing of the default header.php or any other theme default files as any change you apply to them will be wiped when the theme updates. Make sure to use a child theme.

    when i add any content to a required header.php file at ‘/inc/structure/header.php’ the <head> element content gets jumbled (corrupted?).

    That’s strange. The mentioned file in that directory doesn’t do anything to the <head>. Perhaps you meant the <header> tag after the body?

    As for how to address the error, we can’t really tell which to fix as we have no idea which codes are you adding on.

    And if you’re struggling with which codes to place where within the template file, perhaps consider using simple theme specific PHP hooks and filters first?

    Here’s a hook visual guide: https://docs.generatepress.com/article/hooks-visual-guide/

    • This reply was modified 3 years, 11 months ago by Elvin.
    Thread Starter sprowt

    (@sprowt)

    thank you, @ejcabquina, for your reply.

    when i require a file in my own theme like this:

    require get_template_directory . '/path/to/file.php';

    it breaks the <head> element and customizer as i describe above.

    i thought i’d ask you since @wordpress won’t respond which really frustrates and disappoints me.

    so much for the great wordpress support community ??

    but GP is great and you guys always respond, no matter what.

    so thanks for that.

    Lester

    Hi there,

    what is it you’re trying to add to your templates ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘require stmt jumbles element’ is closed to new replies.