plugin-icon

Monetize Me

מאת Shah Alom·
Manage trusted ad code with categories, sponsors, Gutenberg blocks, shortcodes, theme hooks, and automatic content placements.
גרסה
3.0.3
עודכן לאחרונה
Aug 5, 2026
Monetize Me

Monetize Me is a modular, option-based advertising manager for Google AdSense and other trusted third-party monetization code. It does not register a custom post type or taxonomy.

The plugin provides four top-level settings tabs:

  • Ads
  • Ad Categories
  • Sponsors
  • Placements

A new installation includes these starter categories:

  • Header Ads (header-ads)
  • Footer Ads (footer-ads)
  • In-article Ads (in-article-ads)
  • Sidebar Ads (sidebar-ads)

It also includes the starter sponsor General (general). The records are editable and removable.

Main features:

  • Manage ad categories and sponsors independently.
  • Save trusted Google AdSense, script, iframe, HTML, or other monetization code.
  • Assign one category and one sponsor to each ad.
  • Enable or disable individual ads.
  • Keep saved ad cards collapsed initially and expand or collapse them from their headers for easier management of large ad libraries.
  • Randomly select one enabled ad when several ads match the requested filters.
  • Render ads through the [mmps] shortcode.
  • Render ads through the dynamic Advertisement Gutenberg block.
  • Map categories and sponsors to supported theme action hooks.
  • Insert ads between archive items using random intervals or exact positions.
  • Insert ads before content, after content, and between paragraphs.
  • Select which public post types receive automatic Post Content Ads.
  • Optionally enqueue the bundled frontend stylesheet.
  • Extend selection, placement, and rendering with public functions, actions, and filters.

Automatic archive and Post Content Ads are disabled initially. Enable them from Monetize Me > Placements after creating an enabled ad that matches the selected category and sponsor.

On a single-site installation, settings are stored in one regular option and managed from the top-level Monetize Me admin menu.

On WordPress Multisite, the plugin is network-managed. Settings are available only from the top-level Monetize Me page in Network Admin, and one network option controls all sites.

Shortcode

Basic random enabled ad:

[mmps]

Filter by category slug:

[mmps adcategory="in-article-ads"]

Filter by category and sponsor and add an outer CSS class:

[mmps adcategory="in-article-ads" adsponsor="general" classname="article-ad"]

Attributes:

  • adcategory – Saved category ID, name, or slug.
  • adsponsor – Saved sponsor ID, name, or slug.
  • classname – Space-separated CSS classes added to the outer .monetize-me container.

The shortcode always renders one randomly selected enabled ad from the matching records.

Gutenberg Block

Search the block inserter for Advertisement.

Block controls:

  • Ad Category
  • Ad Sponsor
  • Extra CSS Class

The dynamic block always renders one randomly selected matching ad. It always uses the standard frontend wrapper. The editor displays a safe configuration preview and does not execute saved ad scripts or iframes.

Theme Developer Integration

Monetize Me registers callbacks on the following theme action hooks. Add the relevant do_action() call at the intended location in a theme or child theme, then map a category and sponsor to that hook from Monetize Me > Placements. An optional space-separated CSS class string can be passed with each hook and is added to the outer .monetize-me container.

After the site header:

<?php do_action( 'monetize_me_after_header', 'site-header-ad' ); ?>

Immediately before the site footer:

<?php do_action( 'monetize_me_before_footer', 'site-footer-ad' ); ?>

Before an archive loop starts:

<?php do_action( 'monetize_me_before_archive_start', 'archive-start-ad' ); ?>

After an archive loop ends:

<?php do_action( 'monetize_me_after_archive_end', 'archive-end-ad' ); ?>

After each archive item:

<?php global $wp_query; $position = $wp_query->current_post + 1; do_action( 'monetize_me_between_archive_item', get_post(), $position, 'archive-list-ad' ); ?> $position must be a one-based archive item number. The optional third argument is a space-separated CSS class string. The between-item hook renders only when Archive Loop Ads are enabled and the current position matches the configured interval or exact-position rule.

Random interval example: a minimum of 3 and maximum of 4 displays the next ad after a randomly selected gap of three or four additional archive items.

Exact-position example: 3,7,10 displays ads after archive items 3, 7, and 10.

Post Content Ads

Post Content Ads use the the_content filter only on selected singular public post types in the main query and main loop. Password-protected content, feeds, admin requests, and JSON requests are excluded.

Available placements:

  • Before content
  • After content
  • Between paragraphs

The webmaster can select one or more public post types, including registered custom post types. The standard post type is selected by default.

Inline random interval example: a minimum of 3 and maximum of 4 places each next ad after a randomly selected gap of three or four additional paragraphs.

Inline exact-position example: 3,7,10 inserts ads after paragraphs 3, 7, and 10.

Frontend Markup and CSS

All shortcode, block, hook, archive, and Post Content Ad output uses this structure:

<div class="monetize-me category-slug"> <div class="ad-wrapper"> <!-- selected ad code --> </div> </div>

The selected category slug is added to the outer container. Shortcode and block extra classes are also added to that outer container.

The bundled assets/css/frontend.css file is enabled by default. It adds vertical spacing, gives the ad wrapper a measurable full width for responsive networks such as Google AdSense, and centers fixed-size ad content. Disable it from Monetize Me > Placements > Frontend Styles only when the active theme provides equivalent width and alignment rules.

Public Functions

Category APIs:

  • monetize_me_get_categories()
  • monetize_me_get_category( $identifier )
  • monetize_me_get_category_options()

Sponsor APIs:

  • monetize_me_get_sponsors()
  • monetize_me_get_sponsor( $identifier )
  • monetize_me_get_sponsor_options()

Ad selection and rendering APIs:

  • monetize_me_get_ads( $enabled_only = false )
  • monetize_me_get_ad( $ad_id )
  • monetize_me_get_matching_ads( $category = '', $sponsor = '' )
  • monetize_me_select_ad( $category = '', $sponsor = '', $context = array() )
  • monetize_me_render_ad( $category = '', $sponsor = '', $classname = '', $context = array() )
  • monetize_me_render_ad_record( $ad, $classname = '', $context = array() )

Render one random matching ad from a theme template:

<?php $ad_html = monetize_me_render_ad( 'in-article-ads', 'general', 'custom-theme-ad', array( 'source' => 'theme_template', ) ); echo $ad_html; // Intentionally contains trusted ad-network script or iframe markup. ?>

Placement and settings APIs:

  • monetize_me_get_theme_placements()
  • monetize_me_get_placement_settings()
  • monetize_me_get_theme_hook_settings( $hook_name )
  • monetize_me_get_archive_placement_settings()
  • monetize_me_get_content_placement_settings()
  • monetize_me_get_content_post_type_options()
  • monetize_me_should_display_archive_ad( $position )
  • monetize_me_get_placement_ad( $hook_name, $context = array(), $classname = '' )
  • monetize_me_render_placement( $hook_name, $context = array(), $classname = '' )
  • monetize_me_settings_page_url()

Frontend stylesheet APIs:

  • monetize_me_should_enqueue_frontend_css()
  • monetize_me_enqueue_frontend_css()

Important filters include:

  • monetize_me_get_categories
  • monetize_me_get_sponsors
  • monetize_me_get_ads
  • monetize_me_matching_ads
  • monetize_me_selected_ad
  • monetize_me_ad_code
  • monetize_me_rendered_ad
  • monetize_me_theme_placements
  • monetize_me_placement_settings
  • monetize_me_should_display_archive_ad
  • monetize_me_content_post_type_options
  • monetize_me_content_post_types
  • monetize_me_should_enqueue_frontend_css

Raw Ad Code and Security

Ad network code commonly requires <script>, <iframe>, and provider-specific HTML. Monetize Me therefore stores and renders the submitted ad code without KSES filtering, HTML escaping, wpautop(), nl2br(), or automatic <br> insertion.

Only users with the plugin management capability can access save handlers. Every settings form uses a dedicated WordPress nonce, and every write request verifies both the capability and nonce before updating data. On Multisite, management requires the network settings capability.

Because saved code executes on the frontend, paste code only from a trusted provider or advertiser. A compromised administrator account can use any raw-code feature maliciously; protect administrator accounts with strong passwords and multi-factor authentication.

חינםבתוכניות בתשלום
בביצוע ההתקנה, אנחנו מקבלים את הסכמתך לתנאי השירות של WordPress.com ולתנאים של התוסף של הצד השלישי.
נבדקו עד
WordPress 7.0.2
תוסף זה זמין להורדה ולשימוש דרך שברשותך.