This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Add code below opening <body> tag

  • Creator
    Topic
  • #7451
    damian
    Participant

    Hello,

    I’ve just set up Google Tag manager and need the code to be inserted just below the opening <body> tag.

    There are a couple of plugins that can insert the code, but they seem to put it very low on the site. It should go just below the tag.

    Is there anyway I can do this?

    I have Swager set up as a ‘Child theme’, but I don’t know anything about web hooks etc, so if that’s the answer, please help me through it. I just know I have some code that I need to put in place.

    Thanks
    Damian

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #7454
    Jason Bobich
    Keymaster

    Hello Damian,

    This will be a customization you’ll need to make to the theme, and so it make take some learning on your part to make this happen. Yes, I would agree the best answer would be to probably utilize action hooks from your Child theme’s functions.php.

    Here’s a video on how Child theme’s work. It’ll explain what it is and introduce you to where you should be putting action hooks.

    https://vimeo.com/41331677

    Here’s an overview of what action hooks are:

    http://dev.themeblvd.com/tutorial/actions/

    And here is a listing of the theme’s action hooks you can utilize:

    http://dev.themeblvd.com/tutorial/primary-framework-action-hooks/

    The “themeblvd_before” hook will sit just below the opening <body> tag. For example —

    function my_add_code(){
    	?>
    	your add code ...
    	<?php
    }
    add_action('themeblvd_before', 'my_add_code');
    #7504
    damian
    Participant

    Thanks Jason,

    I wasn’t exactly sure what I was doing, but just went for it and it seems to have worked 🙂

    Cheers,
    Damian

Viewing 2 replies - 1 through 2 (of 2 total)
  • The forum ‘Swagger Responsive WordPress Theme’ is closed to new topics and replies.