Code in function.php

Her’s the question: I’m trying to place a code (to connect mailchimp with Wp) in the heder.php file inside the child theme.
I know ther’s no header.php in the child theme and that I should place the code inside function.php, wich I did this way:

add_action(‘wp_head’, ‘add_head_code’);

function add_head_code() {
?>

MAILCHIMP-GENERATED CODE

<?php } Apparently that didn't work properly and I don't see the code in the website source and mailchimp can't either. What's wrong?

Hi Davide,

The code you are using should work. Kindly double check if the child theme is the active theme. If it is the child theme that is active but the generated code is not showing on the site, please check if you have some caching plugin active on the site and please clear the cache.

Is the issue persists, please provide us with the admin access to your site in a Secure Note:

Hey Davide,

The child theme is not active upon checking. Please activate the child theme.

Thanks.

I beg your pardon, I was sure the child theme was the one active. Thanks

Hey Davide,

The child theme was inactive when I checked. I grabbed a screenshot as soon as I clicked on Appearance.

I see that you have activated it now so your code is now outputted.

Thanks again Christian!

You’re welcome, Davide.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.