Home Blog tips How to put ads inside Article?

How to put ads inside Article?


learn a simple way to put ads inside the article. Generally, the ads placed inside the article bid high when compared to ads in the footer, header, and sidebar because they are more interactive to users. Placing ads are easy in case of sidebar because simply copy paste the ad code into text widget area. But come to, put ads inside the article is somewhat difficult, each and every time we need to copy paste the code whenever required inside the article.

In earlier days I face the problem to place the ads inside the article. Finally, I found the solution. Rather than putting ads in all places whenever required. Just create an Ad function in theme.php file in the WordPress editor. placing ads inside article improve AdSense earnings because they have more interaction with users.

Use code

function myAdFunction1()
return’ Add AdSense code here ‘;

Use functions like Adfunction1() and Adfunction2() for corresponding AdSense codes and names myad1 and myad2. Place [myad1] [myad2] where requirement of ads inside article.

How to put ads inside the article?

put adsIn WordPress dashboard go to Appearance >> editor >> in right side menu go to Theme.php >>

Add these functions at bottom and finally hit save.

After completion of adding Ad functions, go to posts in WordPress dashboard, open post and add Ad names like [myad1] and [myad2] whenever required.

Ad placementIn most of the cases, premium themes have ads customization, we can easily customize those ads for mobile, desktop and tablets. Similarly, we can enable and disable those ads for different devices to make our site user-friendly in different platforms.

see more:

         The WordPress plugin named ad injection also a good plugin to place the ads inside the text as well as large customization to words ad places like header, footer, sidebar and finally inside text. You can also enable and disable ads for different pages like home, posts, pages, searches, and Archives. Also restrict ads depending on the length of the post, the age of visitor, and restrict access to the particular IP address. You can serve ads based on different search engines.

This ad function method to served ads is simple and easy to put ads inside the text. If you have any problems while placing the ads, please comment below. I will try to answer your questions. Thank you.


  1. Ad function works well. The problem I have with this is that the article paras vary with the post and sometime the ads do not get placed at the right spot. But I agree, it works most of the time.

Comments are closed.