Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #621603

    Hi,

    I need to insert some advertisement scripts in footer.php, index.php, single.php & header.php between <body> </body> and <head> </head>.
    What’s the best solution to do it in the Child theme?
    Regards,

    #621742

    Hey Anton!

    You can use following code in Functions.php file in Appearance > Editor for your code between body tags

    function custom_link_target(){
    ?>
    // YOUR CODE GOES HERE 
    <?php
    }
    add_action('wp_footer', 'custom_link_target');

    and following for head tags

    function add_custom_code(){
    ?>
    // YOUR CODE GOES HERE 
    <?php
    }
    add_action('wp_head', 'add_custom_code');

    Regards,
    Yigit

    #621791

    Do you mean I can put all scripts provided for
    footer.php,
    index.php,
    single.php
    & header.php
    in one single funtions.php ?

    #622180

    Hi!

    You can use conditional tags to apply the code only on single or index pages. If you can give an example and point out the pages you would like to apply, we can give you an example

    Cheers!
    Yigit

    #645781

    Resolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Advert scripts to insert in the Child theme’ is closed to new replies.