How to Create a WordPress Plugin for Placing Ads Code On the Post

How to place an ads in wordpress posts without changing the theme. By creating a wordpress plugin, we can place ads on wordpress posts correspond to our desire.

How to Create a WordPress plugin for placing ad code on the post

In this tutorial I will share create simple wordpress plugin for placing ad code on the post.

Ad script can be placed in three different locations
– Under the title of the post
– In the middle of posts
– At the end of the posting

For example, I use wordpress theme RTPANEL as an implementation to create advertising script location plugin

Let’s try to create this plugin.
1. Create a folder called AIP
2. Create a php file with the name AIP.php
3. Copy the script below and paste it on AIP.php

1. Create plugin header

2. Create setting function for save your ads script to wordpress database

3. To show the ads settings menu, use

to call register_my_custom_menu_page_aip function
4. The ad script will show in your content with

5. Create adscontent function to show your ad

Similarly, how to create a plugin to put your ad code in wordpress post, you can download my plugin here.

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.