Embed Adsense anywhere on your posts using shortcode

December 23, 2008 · Print This Article

Do you ever wanted to get a total control over the way your adsenses ads are displayed?

In the following text, I’m going to teach you how to be able to use adsense only in the post you want and display the ads where you want.

To achieve this aim, we just use shortcode of wordpress.

First, you have to add the following code to your function.php file. Don’t forget to change the adsense code.

function showads() {
return 'your adsense code';
}

add_shortcode('adsense', 'showads');

Once you saved the functions.php file, you’re now able to embed your adsense code on your posts and display it exactly where you want. To do so, simply paste the following code on the editor, in html mode:

[adsense]


Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.