Adsense block inside WordPress posts – Create your own shortcode

With simple plugin we can create responsive adsense ad shortcode and put it anywhere inside our WordPress post.
Here is how to create it.

The usage is easy. Just put [responsive_adsense] anywhere inside your post, and responsive adsense ad will appear there.
Another shortcode in our code – [responsive_adsense_single] is for cases if you want those ads to appear only in single page (not in another pages where post content shown)

WordPress shortcode - preview
Here is how it is in editor
WordPress shortcode - editor view
Here is how it is in real web page

That’s all. Where to add this code? To your child theme functions.php file, or to you own custom plugin which you can easily create in 30 seconds.


Discover more from WP DEV - Elvin Haci

Subscribe to get the latest posts sent to your email.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from WP DEV - Elvin Haci

Subscribe now to keep reading and get access to the full archive.

Continue reading