Shortcodes are a very interesting and powerful WordPress function that can, for example, be used to display Google Adsense ads anywhere on your blog posts and pages. If you have read the first recipe of this chapter, you are probably thinking, 'What about pasting this WordPress shortcode directly in a sidebar widget?'
Using a custom WordPress shortcode to display your Adsense ads code is a lot quicker, and simpler, than pasting the whole code provided by Google. But sadly, by default, shortcodes can't be inserted into text widgets.
To change this, simply edit your functions.php file and paste the following code:
add_filter('widget_text', 'do_shortcode'); Now, you can insert WordPress shortcodes into sidebar widgets.
Was this article helpful?
Have you ever wondered how people make money through the internet by doing almost nothing? The Secret ADSENSE, Googles Online Advertising Program. What is AdSense? How to get registered with AdSense Programs? What are the different types of AdSense programs? What are the tips and tricks for earning more through AdSense? How do I stop the Ads of competitors from appearing on my website? How do I get paid? Do I get reports for analyzing the performance of my website?