الجمعة، 29 مارس 2013

add google adsense anywhere you want!!

How to Insert Google Adsense Anywhere in Your Blog Post

Creating a shortcode

You need to add the following code into your functions.php file. You can do this in your dashboard, just go to ‘Appearance’ => ‘Editor’ open your functions.php file. Scroll-down to the end of this file and add this code in new line:
?
1
2
3
4
function adsenseads() {
    return '<div id="adsenseads">Put your Google Adsense banner code here</div>';
}
add_shortcode('showmyads', 'adsenseads');
Do it like on my screenshot:
Insert-Google-Adsense-Anywhere-Your-Blog-Post
Save your changes.

Showing Adsense ads anywhere in your posts

Now you can use this shortcode to insert Adsense into your post, just choose the place in your test and write the following code:
[showmyads]
You can use this WordPress shortcode in posts and pages.

Styling Your Banner

Your Adsense banner can be styled in your style.css file, because it is inserted with div element (id #adsenseads). You can add some merges, float parameters, etc.

ليست هناك تعليقات:

إرسال تعليق