Created
March 26, 2019 15:01
-
-
Save imuhammadshoaib/d595be5ad830903bf1f14bca8a95250d to your computer and use it in GitHub Desktop.
WordPress Shortcode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function get_adsense($atts) { | |
| return '<script type="text/javascript"><!-- | |
| google_ad_client = "pub-546321545321589"; | |
| /* 468x60, created 9/13/10 */ | |
| google_ad_slot = "54321565498"; | |
| google_ad_width = 468; | |
| google_ad_height = 60; | |
| //--> | |
| </script> | |
| <script type="text/javascript" | |
| src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> | |
| </script> | |
| '; | |
| } | |
| add_shortcode('adsense', 'get_adsense'); | |
| /*That’s it! The first parameter passed in is the name of the shortcode, so in our case, ‘adsense’ tells WordPress to create the [adsense] shortcode. The second parameter designates the function that will be called when the new shortcode is encountered. Again, in our case, ‘get_adsense’ tells WordPress to replace [adsense] with the results of our get_adsense method.*/ |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shortcode [adsense]