editing header – genesis theme -vs- child theme edits

Community Forums Forums Design Tips and Tricks editing header – genesis theme -vs- child theme edits

This topic is: not resolved

This topic contains 6 replies, has 2 voices, and was last updated by  braddalton 3 months, 4 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #112822

    jhguynn
    Participant
    Post count: 223

    In order to track keywords in a PPC campaign through Google adwords, I need to put the following code after the opening ‘php’ tag in the header:

    if(!empty($_GET['keyword']))
    $_SESSION['keyword']= $_GET['keyword'];
    if(!empty($_GET['campaignname']))
    $_SESSION['campaignname']= $_GET['campaignname'];

    The only place I can think to do this is in header.php of the genesis parent them. Is this the right move? Is there any way to make this edit in the child theme so I leave the parent untouched? I see no header.php in Enterprise Pro child theme.

    Thanks for the help.

    • This topic was modified 4 months ago by  jhguynn.
    • This topic was modified 4 months ago by  jhguynn.
    #112825

    braddalton
    Participant
    Post count: 10356

    You can try using the Header and Footer Scripts.

    Go to Genesis > Theme Settings.

    Or you can hook it from your functions file.


    #112829

    jhguynn
    Participant
    Post count: 223

    Thanks Brad. When I add the code to theme settings, it outputs as text at the top of every page. See screenshot here:

    Theme header output – screenshot

    I don’t know how to hook the above mentioned code from the functions file, but that sounds like the right solution. How do I do that?

    #112831

    braddalton
    Participant
    Post count: 10356

    Is that all the code?

    Shouldn’t because that’s where GA code also goes.

    Simply hooks plugin is the easiest solution to execute code in a specific position and each hook field explains exactly where the code executes.


    #112845

    jhguynn
    Participant
    Post count: 223

    Thanks again Brad. I use Google Universal Analytics plugin to insert GA code. I’ll give Genesis Extender a shot at inserting my code in the header section. If that doesn’t work, I’ll try the Simply hooks plugin you mentioned. Appreciate your help.

    #112949

    jhguynn
    Participant
    Post count: 223

    Brad: I just realized why my code was displaying as text when placed in the the following location: Genesis –> Theme Settings –> Header and Footer Scripts. I had forgotten to wrap the code in <?php ?> tags.

    #112954

    braddalton
    Participant
    Post count: 10356

    Thought there was a simple reason for that.

    I did look in my Adsense account for that code but couldn’t find it as i really wanted to write a post about how to add that code using various methods.


Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.