 
	
		
		
		
		
			
- 
		AuthorPosts
- 
		
			
				
April 22, 2018 at 4:49 pm #945066Hello friends: 
 Google Adsense automatic ads are automatically displayed in the best place on the page. Now, I have inserted the adsense code in the Header of the plugin “Header and Footer Scripts” and works fine but the problem is that I get ads on all pages, while I want them to go out alone in the posts. So I think I have to manually place the code in the header, but I do not know where and how.Finally my question is: Where can I place the Adsense code so that the ads only appear in the posts and in no other pages included the home page? I’ll appreciate any help for your side. 
 Best Regards,
 Jose Ramon- 
		This topic was modified 7 years, 6 months ago by Jose Ramon. 
 April 22, 2018 at 5:27 pm #945072Hey José Ramón, 
 This is the first time I’ve heard of Google Adsense automatic ads, but I believe that within your Adsense control panel you should be able to exclude pages of your site, I recommend looking for the correct way there.
 But another method would be to use a conditionally function in WordPress to only post the header code on posts. First remove your Adsense header code, then add it to this function in your functions.php
 *Hopefully you are using a child theme because when editing functions.php you should use the child theme, so your changes will not be lost with future theme updates Read about it & Get it here// adsense code only on single posts function add_custom_adsense(){ if ( is_single() ) { ?> <script> //ADD YOUR ADSENSE CODE HERE </script> <?php } } add_action('wp_head', 'add_custom_adsense');Best regards, 
 MikeApril 22, 2018 at 6:11 pm #945083Hi Mike: 
 Works fine with your code!
 Thank you so much.Best Regards, 
 José RamónP.D. Yes, I’m using Enfold child theme April 22, 2018 at 6:34 pm #945091Hi, 
 Glad we were able to help, we will close this now. Thank you for using Enfold.For your information, you can take a look at Enfold documentation here 
 and the video tutorials here
 And if there are features that you wish Enfold had, you can request them and vote the requested ones here
 For any other questions or issues, feel free to start new threads under Enfold sub forum and we will gladly try to help you :)Best regards, 
 Mike
- 
		This topic was modified 7 years, 6 months ago by 
- 
		AuthorPosts
- The topic ‘New Automatic Google Adsense Ads; want ads only in the post and no in pages.’ is closed to new replies.
