Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #709203

    Hi – in order to add google analytics event tracking I need to be able to add js snippets to the <head> tag on a page basis.
    Editing head.php in the child theme lets me add code to every page – how can I add code on specific pages only?
    Many Thanks.

    #709212

    Hey!

    Please add following code to Fuctions.php file in Appearance > Editor and change page ID as needed

    add_action('wp_head','ava_custom_header_code');
    function ava_custom_header_code() {
    if(is_page(59)){
    ?>
    // Your code goes here
    <?php 
    }
    }

    Best regards,
    Yigit

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.