Add ads between content without plugin

Plugins are great way to extend WordPress functionality.But they should be used with care.Having great number of plugins does impact your website performance.As a rule of thumb plugins should only be used for major tasks like search engine optimization and caching or doing some particular tasks which needs considerable effort.

For all other minor tasks it is better not to use plugins.One of such tasks is placing advertisement in between content.Ads between content tend to perform better than other placements.Using plugin for this function adds unnecessary code.

Follow below steps to add ads between content without plugin (this method will work for most of the themes).But in case your theme supports ads between content functionality then you must use that

open functions.php file of your theme.This file may be located inside your theme folder or any o its subfolder (most likely in include sub folder).Location of file varies from one theme to another theme.This is the most complicated part of the customization.

Now above code will display Google Adsense ads between content.The ad will be aligned left and content will be wrapped around it.I have used dummy adsense ad code.You will have to replace the ad code with your adsense code.Above code will work fine for images,videos and all other content (ad codes from other advertising network as well).

You can modify the code according to your requirement.For example to justify the ad code to right you need to replace left in above code to right.To display ads between content in middle you need to replace left with center in above code.

The above ad will not be shown to logged in user (I prefer this setting so as to avoid accidental clicks on my own ads).If you want to remove that setting simply delete ! is_user_logged_in() && from above code.

Ads will be displayed only on single pages.This is important as some themes now show full post on excerpt page and not including this check will result multiple ads displayed on archive pages (violation of google adsense terms) so keep the is_single check intact.

above code with your own ad code..in case you have any trouble it would be great if you can post your code here (changing your ad code) ..You need to embed code between tags..or you can post on social site as message (if facing issues posting here)