Create Adsense shortcode for WordPress

  1. Go to Your Dashboard WordPress
  2. Click menu -> Appearance
  3. Click editor -> choose functions.php
  4. Add below code inside <?php
 * enqueue adsbygoogle.js in the footer & 
 * create a WordPress shortcode with your Google AdSense code
 * follow me on Twitter: @DimasSkynetCybe

function loadAdsenseJS() {
  wp_register_script( 'google-adsense', '//', '', '', true );
  wp_enqueue_script( 'google-adsense' );
add_action( 'wp_enqueue_scripts', 'loadAdsenseJS' );

function AdSense() {
  $output = '<ins class="adsbygoogle"
    style="background-color: transparent;
      text-decoration: none;
  (adsbygoogle = window.adsbygoogle || []).push({});
  return $output;
add_shortcode( 'adsense', 'AdSense' );

/* * Usage: add [adsense] in your WordPress posts * where you want your ad to appear */

0 Response to "Create Adsense shortcode for WordPress"

Post a comment

Bila Ada posting yang kurang, atau error atau yang lainnya, silahkan tinggalkan komentar agar artikel/post di perbaiki.
Jangan Lupa Cek Box "Notify Me" agar tahu komentar kamu dibalas oleh saya.

If there are any posts that are missing, or error or anything else, please leave a comment for the article / post to be fixed.
Do not Forget Check Box "Notify Me" to know our comments replied by me.

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel

Artikel Terkait