How to insert google adsense ads on a wordpress site


After the abolition of the plugin for automatic embedding ads on a site under wordpress, I got discouraged and started googling what to do. In this post I’ll tell you my way of inserting ads into the site, which is not written anywhere. Source: wordpress, hueman theme, manually generated responsive ads google adsense ad units, suitable for mobile devices.

How to insert ads in the header or footer is more or less clear – in the theme editor (Appearance -> Editor \ Appearance -> Editor) file header.php or footer.php, respectively, and there insert the generated javascript code inside the body. In my theme, it’s more convenient to insert ads in these areas via widgets! How do I insert an ad in the header above the main website template? The gist is the same, only the code needs to be put in the head! In my theme it did not work because of the dynamic top menu.
 
How to put ads inside the post? We are looking for single-tmpl.php (tmpl/single-tmpl.php) or just single.php – here you can edit a single post or a separate site entry (do not confuse with the separate page). Insert the code of our ad after <?php the_content(); ?>, this will display ads after the text at the end of the post. You can insert it in any other place. How to make the ads appear inside the text of the post, that’s a more difficult task. As I figure it out, I’ll write!

This entry was posted in Wordpress (en). Bookmark the permalink.

Leave a Reply

🇬🇧 Attention! Comments with URLs/email are not allowed.
🇷🇺 Комментарии со ссылками/email удаляются автоматически.