Skip to content

tcadieux/wordpress-ad-zone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ad Zone

A lightweight WordPress plugin that makes it easy to add and manage ad tags on your site without knowing HTML, JavaScript, or CSS.

Features

  • No coding required - Simple interface for adding ads
  • Global header script - Add site-wide scripts (perfect for Google AdSense auto ads)
  • Shortcode support - Use [ad id="your-ad-name"] anywhere
  • Multiple ad slots - Add unlimited ad positions
  • Easy management - Enable/disable ads with a checkbox
  • Any ad network - Works with Google AdSense, Amazon, custom HTML/JS
  • Widget compatible - Use in Text/HTML widgets
  • Theme integration - Use in template files

Installation

Method 1: Manual Upload

  1. Download the ad-zone folder
  2. Upload it to /wp-content/plugins/ on your WordPress site
  3. Go to Plugins in your WordPress admin
  4. Activate "Ad Zone"

Method 2: ZIP Upload

  1. Zip the ad-zone folder
  2. In WordPress admin, go to Plugins > Add New > Upload Plugin
  3. Choose the ZIP file and click "Install Now"
  4. Activate the plugin

How to Use

Step 1: Set Up Global Header Script (Optional but Recommended)

Many ad networks like Google AdSense require a script in the <head> of every page.

  1. Go to Ad Zone in your WordPress admin menu
  2. Find the Global Header Script section at the top
  3. Paste your header code (e.g., Google AdSense auto ads script)
  4. Click "Save All Ads"

Example - Google AdSense Header Script:

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXXXXXXXXXXXXX"
     crossorigin="anonymous"></script>

This will automatically appear in the <head> section of all your pages!

Step 2: Add Your Individual Ads

  1. Scroll to Individual Ad Spots section Go to Ad Zone in your WordPress admin menu
  2. Give your ad a unique name (e.g., "sidebar-ad", "header-banner")
    • Use only lowercase letters, numbers, and hyphens
  3. Paste your ad code in the "Ad Code" box
    • Google AdSense code
    • HTML banner code
    • JavaScript ad tags
    • Any custom HTML/CSS/JS
  4. Make sure "Active" is checked
  5. Click "Save All Ads"

Step 3: Display Your Ads

In Posts or Pages

Just type the shortcode in the editor:

[ad id="sidebar-ad"]

In Widgets

  1. Go to Appearance > Widgets
  2. Add a "Text" or "HTML" widget
  3. Enter the shortcode: [ad id="sidebar-ad"]

In Your Theme

Add this to your template files:

<?php echo do_shortcode('[ad id="sidebar-ad"]'); ?>

Examples

Complete Google AdSense Setup

Step 1 - Header Script (Goes in "Global Header Script"):

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXXXXXXXXXXXXX"
     crossorigin="anonymous"></script>

Step 2 - Individual Ad (Create an ad spot named "sidebar-ad"):

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-XXXXXXXXXXXXXXXX"
     data-ad-slot="1234567890"
     data-ad-format="auto"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>

Step 3 - Use the shortcode:

[ad id="sidebar-ad"]

Simple HTML Banner

<a href="https://example.com">
    <img src="https://example.com/banner.jpg" alt="Ad" />
</a>

Custom HTML/CSS

<div style="background: #f0f0f0; padding: 20px; text-align: center;">
    <h3>Special Offer!</h3>
    <p>Get 50% off with code SAVE50</p>
    <a href="https://example.com" style="background: #007bff; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px;">Shop Now</a>
</div>

Common Use Cases

Sidebar Ads

  • Name: sidebar-ad
  • Place in sidebar widget
  • Use shortcode: [ad id="sidebar-ad"]

Header Banner

  • Name: header-banner
  • Add to header.php or use in widget
  • Use shortcode: [ad id="header-banner"]

In-Content Ads

  • Name: content-ad
  • Insert in blog posts
  • Use shortcode: [ad id="content-ad"]

Footer Ads

  • Name: footer-ad
  • Add to footer widget
  • Use shortcode: [ad id="footer-ad"]

Tips

  1. Use descriptive names - "sidebar-ad" is better than "ad1"
  2. Test ads first - Create, save, and check if they display correctly
  3. Disable temporarily - Uncheck "Active" instead of deleting
  4. Multiple positions - Create different ads for different locations
  5. Responsive ads - Most ad networks provide responsive code automatically

Troubleshooting

Ad not showing?

  • Check that the ad is marked as "Active"
  • Verify the ad name matches your shortcode exactly
  • Look for the HTML comment in page source: <!-- Ad Zone: Ad "your-ad-name" not found or inactive -->

Ad code not working?

  • Make sure you copied the complete code from your ad network
  • Some ad networks require time before ads appear
  • Check browser console for JavaScript errors

Shortcode showing as text?

  • Make sure you're using the Text/Visual editor, not Code editor
  • In widgets, use "Text" or "HTML" widget types
  • In theme files, use <?php echo do_shortcode('[ad id="name"]'); ?>

File Structure

ad-zone/
├── ad-zone.php    # Main plugin file
├── admin-style.css           # Admin interface styling
├── admin-script.js           # Admin interface JavaScript
└── README.md                 # This file

Requirements

  • WordPress 5.0 or higher
  • PHP 7.0 or higher

Support

For issues or feature requests, please contact your plugin developer.

License

GPL v2 or later

Changelog

Version 1.0.0

  • Initial release
  • Basic ad management
  • Shortcode support
  • Admin interface
  • Enable/disable functionality

About

Wordpress Plugin for inserting ads (Google, Amazon, etc.) on your page

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published