Is there a way to add code within the head section?

This topic has 7 replies, 4 voices, and was last updated 4 years, 1 months ago ago by Olga Barlow

  • Avatar: gdd
    gdd
    Participant
    January 22, 2021 at 20:37

    Is there a way to add code within the head section? Not the headER…but in the head. Before the Body section. I could hard code it in the template files, but I was trying to find a way so the client never has to touch those files. It would be nice for them to be able to do that without any additional plugins or accessing the template files. Their current theme uses Divi and apparently Divi has a way to do that. I couldn’t find it with xStore.

    Thanks!

    6 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 23, 2021 at 09:30

    Hello,

    You can use https://wordpress.org/plugins/insert-headers-and-footers/ plugin.
    Also, you can post the request here – https://www.8theme.com/taskboard/ , then our developers will see it.

    Regards

    Avatar: gdd
    gdd
    Participant
    January 26, 2021 at 01:21

    They did end up using a plugin. But it’s a simple addition within your theme that could really enhance an already awesome xstore. I’ve gone ahead and submitted a feature request via the link you sent, so thanks for that.

    Avatar: anandmahey
    anandmahey
    Participant
    January 26, 2021 at 04:22

    I’m not sure if this is what you need, but for google tag, facebook pixels, and other verification tags and code this works for me.

    1. Create a Static Block with the code you want to add. Give it a name you’ll be able to recognise coz you’ll need to select it later.
    2. Insert HTML Block to Top Header, and Enable “Use Static Block” for HTML Block 1.
    3. Select the Static Block with your code.

    Hi Rose, may be 8theme can create a tutorial for this?

    Avatar: Olga Barlow
    Olga Barlow
    Participant
    January 26, 2021 at 15:45

    Hello, @anandmahey

    Thank you for your suggestion but once you change theme you will lose this customization. That’s why we recommend using Insert Headers and Footers plugin because you don’t need to set it up again once you change the theme.

    Regards

    Avatar: gdd
    gdd
    Participant
    January 27, 2021 at 18:29

    Sometimes there is need to add code inside the head, not in the body. As a developer, of course I have work arounds but a lot of themes I’ve worked with include a place to add items inside the head tag (not the header in the body). It’s a minor but extremely useful addition. Adding plugins or editing the functions file is a last resort. The whole point is to make it easier for my clients who don’t know or want to deal with hard coding things to edit the head area.

    I do use static block, for something else though, but that isn’t what I was looking for. Thanks!

    Avatar: Olga Barlow
    Olga Barlow
    Participant
    January 27, 2021 at 22:18

    Hello, @gdd

    This plugin https://wordpress.org/plugins/insert-headers-and-footers/ created for such purposes and you won’t lose the code even if you change the theme.

    Regards

  • Viewing 7 results - 1 through 7 (of 7 total)

The issue related to '‘Is there a way to add code within the head section?’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.