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,
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
Do you mean I can put all scripts provided for
footer.php,
index.php,
single.php
& header.php
in one single funtions.php ?
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
Resolved