=== Monetize Me ===
Contributors: shahalom
Donate link: https://microsolutionsbd.com/
Tags: ads, advertisement, ad manager, shortcode, block
Requires at least: 6.4
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 2.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Manage advertisement scripts as Ads and display them using a shortcode, widget, or block.
== Description ==
Monetize Me lets you store advertisement code or monetization snippets as a custom post type called Ads and display them anywhere on your WordPress site.
The plugin supports three display methods:
1. Shortcode
2. Classic Widget
3. Block Editor block
You can organize ads with:
- Ad Categories
- Ad Sponsors
This makes it easy to:
- display a specific ad by slug
- display random ads from a category
- filter ads by category and sponsor
- reuse the same ad in multiple places
= Main features =
- Custom post type for ads
- Ad Category taxonomy
- Ad Sponsor taxonomy
- [mmps] shortcode
- Classic widget support
- Block Editor support
- Randomized ad output
- Optional wrapper markup around each ad
= Shortcode =
The main shortcode is:
[mmps]
Supported attributes:
- id
Display one specific ad by post slug.
- adcategory
Either a single slug of ad Category or CSV IDs of Ad Category.
- adsponsor
One or more Ad Sponsor term IDs separated by commas.
- limit
Number of ads to display. Default: 1
- wrapper
Wrap each ad in
. Accepts 1 or 0. Default: 1
- class
Extra alignment or styling class for the outer wrapper.
= Shortcode examples =
Display a specific ad by ad slug:
[mmps id="homepage-leaderboard"]
Display one random ad from category ID 12:
[mmps adcategory="12"]
Display one random ad from the ad category with the slug "in-article-ad":
[mmps adcategory="in-article-ad"]
Display two random ads from category ID 12:
[mmps adcategory="12" limit="2"]
Display ads from category 12 and sponsor 3:
[mmps adcategory="12" adsponsor="3"]
Display an ad without wrapper markup:
[mmps id="sidebar-ad-1" wrapper="0"]
= Widget =
Use the Show Advertisement widget to display:
- ads from an Ad Category, or
- one specific ad by slug
= Block =
The plugin includes a block for the WordPress block editor so you can insert ads visually inside posts, pages, and widget areas that support blocks.
= Notes =
This plugin is designed for site administrators and trusted editors who need to store and output ad code. Because advertisement code may include HTML and script snippets, you should only grant access to trusted users.
== Installation ==
1. Upload the plugin folder to /wp-content/plugins/, or install it through the WordPress Plugins screen.
2. Activate the plugin.
3. Go to Ads in the WordPress admin menu.
4. Create one or more ads.
5. Assign Ad Categories or Ad Sponsors if needed.
6. Display the ads with the shortcode, widget, or block.
== Frequently Asked Questions ==
= Where do I manage my ads? =
After activation, a menu named Ads appears in the WordPress admin area.
= How do I display a specific ad? =
Use the ad post slug in the shortcode:
[mmps id="your-ad-slug"]
= How do I display ads from a category? =
Use the category term ID:
[mmps adcategory="12"]
= Can I display more than one ad? =
Yes. Use the limit attribute:
[mmps adcategory="12" limit="3"]
= Does the plugin keep my existing ads after uninstall? =
Yes. Version 1.9.0 uses a conservative uninstall routine and does not delete your ad posts or taxonomy terms automatically.
= Who should use this plugin? =
This plugin is best for website owners, publishers, bloggers, and developers who want a simple way to manage advertisement snippets inside WordPress.
== Screenshots ==
1. Ad post type screen
2. Ad Categories and Ad Sponsors
3. Shortcode example in the editor
4. Block insertion example
== Changelog ==
= 2.0.0 =
* Added a centralized Ad_Service class used by shortcode, widget, block, and renderer layers
* Added cache-aware ad queries with automatic cache purging on ad save, delete, and taxonomy changes
* Added public helper API functions: monetize_me_get_ad(), monetize_me_get_random_ads(), monetize_me_render_ad(), mm_get_ad(), mm_get_random_ad(), and mm_render_ad()
* Added internal filters and actions for query arguments and rendered output
* Preserved backward compatibility for existing shortcode, widget, block, and Renderer::render() usage
= 1.9.0 =
* Major internal refactor for maintainability
* Added modern plugin bootstrap structure
* Removed runtime rewrite flushing
* Improved shortcode normalization and rendering
* Fixed widget slug handling bug
* Modernized block registration structure
* Added safer uninstall behavior
* Updated readme and repository packaging
= 1.0.1 =
* Revert back the ad sponsor taxonomy
= 1.0.0 =
* Recreated the plugin by removing legacy width and height taxonomies
* Added Ad Category taxonomy
* Added Gutenberg block support
== Upgrade Notice ==
= 2.0.0 =
This release adds a centralized ad service layer, cache-aware ad queries, and new public helper functions while keeping existing ads, taxonomies, blocks, widgets, and shortcode usage compatible.
= 1.9.0 =
This is a major internal upgrade focused on performance, maintainability, and repository readiness. Existing ads, taxonomies, and shortcode usage remain compatible.