One more topic about Adsense

Hi everyone,

Well, I apologize in advance for asking this question but I am a little bit confused.
I am trying to add the google Adsense code to my site (http://aquariumbreeder.com).
How can I add the code to my Child theme?
I have found here that there are two option

(1)

(2)

Which one and where exactely should I put it?

<?php // ============================================================================= // FUNCTIONS.PHP // ----------------------------------------------------------------------------- // Overwrite or add your own custom functions to X in this file. // ============================================================================= // ============================================================================= // TABLE OF CONTENTS // ----------------------------------------------------------------------------- // 01. Enqueue Parent Stylesheet // 02. Additional Functions // ============================================================================= // Enqueue Parent Stylesheet // ============================================================================= add_filter( 'x_enqueue_parent_stylesheet', '__return_true' ); // Additional Functions // ============================================================================= // Custom Entry Meta // ============================================================================= if ( ! function_exists( 'x_ethos_entry_meta' ) ) : function x_ethos_entry_meta() { // // Author. // $author = sprintf( ' %1$s %2$s', __( 'by', '__x__' ), get_the_author() ); // // Output. // if ( x_does_not_need_entry_meta() ) { return; } else { printf( '

%1$s

', $author); } } endif; // ============================================================================= Thanks!

Hello Michail,

Thanks for writing in!

You need to add the code in child theme function.php file. Here’s some resource that you can take a look at setup child theme.

In case you don’t want to go with child theme, you also have the option of using plugins. Please take a look at following tutorial for more information:

Thanks.

This is no what I was asking. I already have Child theme and would like to put the code there.
However, If I put this code

after
23 // Additional Functions
24 // =============================================================================
I get this mistake

Your PHP code changes were rolled back due to an error on line 25 of file wp-content/themes/x-child/functions.php. Please fix and try saving again.

syntax error, unexpected ‘<’

That is why I ask how can I fix it.
Thank you

PS
Also If I put this code in widget (sidebar) I do not see the “Blank area” (untill google approves) where the code is.

I put this code at the end of your child theme’s functions.php file.
Hope that I do it right. At least I do not get any Error messanges.

Hi Michail,

That’s correct. Have a great day! :slight_smile:

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