DocsOAdsPHP API (Developer Reference)
Developer

PHP API (Developer Reference)

OAdsorravo.com/docs/oads/php-api-developer-reference

OAds_CPT

php// Get active ads for a section
OAds_CPT::get_ads( string $section, int $limit, string $placement, array $ctx ): array

// Get all meta for an ad
OAds_CPT::get_ad_data( int $ad_id ): array

// Targeting check (returns false if ad should not be shown)
OAds_CPT::passes_targeting( int $ad_id, array $ctx ): bool

OAds_Display

php// Output card ads
OAds_Display::get_ads_html( string $section, int $count ): string

// Output inline ads
OAds_Display::get_inline_ads_html( string $section, int $count ): string

// Render a single ad (returns HTML string)
OAds_Display::render_ad( WP_Post $ad, string $section, string $format ): string

// Detect current section from WP context
OAds_Display::detect_section(): string

OAds_Tracker

php// Record an impression
OAds_Tracker::record_impression( int $ad_id, string $page_url, string $section ): void

// Record a click
OAds_Tracker::record_click( int $ad_id ): void

// Per-ad stats
OAds_Tracker::get_ad_stats( int $ad_id, string $period ): array
// Returns: [ impressions, clicks, ctr, revenue ]

// Overview stats (all ads)
OAds_Tracker::get_overview_stats( string $period ): array

// Raw log
OAds_Tracker::get_recent_log( int $limit, string $type ): array

// Export to CSV (exits)
OAds_Tracker::export_csv( string $type, string $period ): never

OAds_Zones

phpOAds_Zones::get_all(): array
OAds_Zones::get_by_id( int $id ): ?object
OAds_Zones::get_by_slug( string $slug ): ?object
OAds_Zones::save( array $data ): int|false
OAds_Zones::delete( int $id ): bool

OAds_Groups

phpOAds_Groups::get_all(): array
OAds_Groups::get_by_id( int $id ): ?object
OAds_Groups::get_ads_in_group( int $group_id ): array
OAds_Groups::pick_ad( int $group_id ): ?WP_Post
OAds_Groups::maybe_pick_winner( int $group_id ): void
OAds_Groups::save( array $data ): int|false
OAds_Groups::delete( int $id ): bool

PHP API (Developer Reference) — OAds Docs — Orravo