Skip to content

Conversation

@GaryJones
Copy link
Collaborator

Summary

  • Adds a wrapper div around all ad output with descriptive CSS classes for better styling control
  • Default classes: acm-wrapper (generic) and acm-tag-{tag_id} (specific)
  • New acm_wrapper_classes filter allows customisation or disabling the wrapper
  • Includes integration tests for the new functionality

This addresses a long-standing request (from 2013) for better CSS targeting of ads without relying on fragile numeric IDs.

Test plan

  • Verify ads are wrapped in a div with class="acm-wrapper acm-tag-{tag_id}"
  • Test acm_wrapper_classes filter can add custom classes
  • Test returning empty array from filter disables the wrapper
  • Run integration tests: composer test:integration

Fixes #71

🤖 Generated with Claude Code

This addresses a long-standing request from 2013 for better styling control of ad output. Previously, themes needed to target ads by numeric IDs that could change, making consistent styling difficult.

The implementation wraps all ad output in a div with descriptive CSS classes: a generic 'acm-wrapper' class for broad styling rules, and a tag-specific 'acm-tag-{tag_id}' class for targeted control. This enables straightforward centering and other layout adjustments without depending on fragile numeric IDs.

A new 'acm_wrapper_classes' filter allows developers to customise the classes or disable the wrapper entirely by returning an empty array, ensuring backwards compatibility for sites that need to opt out.

Fixes #71
@GaryJones GaryJones requested a review from a team as a code owner December 21, 2025 12:47
@GaryJones GaryJones self-assigned this Dec 21, 2025
@GaryJones GaryJones added the type: enhancement New feature or request label Dec 21, 2025
@GaryJones GaryJones added this to the 0.8.0 milestone Dec 21, 2025
@GaryJones GaryJones merged commit 051f3b5 into develop Dec 21, 2025
17 checks passed
@GaryJones GaryJones deleted the fix/71-add-wrapper-classes branch December 21, 2025 13:01
GaryJones added a commit that referenced this pull request Dec 21, 2025
Add comprehensive PHPDoc documentation for all 24 filters and 2 actions
in the Ad Code Manager plugin, improving discoverability and developer
experience.

Documented filters include:
- Configuration: acm_register_provider_slug, acm_provider_slug,
  acm_whitelisted_script_urls, acm_whitelisted_conditionals,
  acm_logical_operator, acm_manage_ads_cap, acm_ad_tag_ids,
  acm_ad_code_args
- Rendering: acm_output_html, acm_output_tokens,
  acm_output_html_after_tokens_processed, acm_disable_ad_rendering,
  acm_wrapper_classes (already documented in #188)
- Matching: acm_display_ad_codes_without_conditionals,
  acm_conditional_args, acm_reset_postdata_before_match,
  acm_matching_ad_code_cache_expiration
- Admin: acm_list_table_columns, acm_list_table_per_page,
  acm_validate_ad_code, acm_allowed_get_posts_args, acm_ad_code_count
- Other: acm_default_url, acm_should_do_robotstxt,
  acm_robotstxt_disallow

Documented actions:
- acm_tag: Displays an ad tag on the frontend
- acm_options_form: Fires in the options form

Fixes #157

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@GaryJones GaryJones mentioned this pull request Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add classes to wrapping div to allow better styling

2 participants