Automation Theme
The Automation theme is a custom WordPress theme that powers the content management and automation workflows for Man In America. It provides a comprehensive admin interface for managing podcasts, broadcasts, guests, and automated publishing to multiple platforms.
Repository Location
The Automation theme source code is located in the automation repository: AmericanMedia/automation
Overview
Purpose
The Automation theme transforms WordPress into a podcast production control center:
- Podcast Management — Create and manage podcast episodes with rich metadata
- Livestream Publishing — One-click publishing to Rumble, YouTube, Boxcast, Restream
- AI Content Generation — Generate descriptions, summaries, and social posts
- Social Media Automation — Automated posting to Telegram, Twitter, Facebook
- Guest Management — Track guest information and booking pipeline
- Sync & Scraping — Fetch metadata from Rumble episodes automatically
Theme Structure
wp-content/themes/automation/
├── style.css # Theme metadata
├── functions.php # Main theme file
├── index.php # Template fallback
├── assets/
│ └── js/
│ └── podcast-sync-actions.js
└── includes/
├── simple_html_dom.php # HTML parsing library
├── catalog.php # Podcast sync & metadata
├── live.php # Livestream status checking
├── api-podcasts.php # REST API endpoints
├── dropbox.php # Dropbox integration
├── transistor.php # Transistor podcast hosting
├── post-types/ # Custom post types
│ ├── post-types.php
│ ├── broadcast.php
│ └── guest.php
├── admin/ # Admin tools & UI
│ ├── admin-tools.php
│ ├── css/
│ └── js/
└── automation/ # Core automation system
├── core/ # Framework files
├── handlers/ # Step execution
├── steps/ # Platform integrations
├── buttons/ # Action buttons
├── boxcast/ # Boxcast-specific
├── prompts/ # AI prompt templates
└── ui/ # Flow tracker UICustom Post Types
Podcast
The primary content type for managing episodes.
| Field | Type | Description |
|---|---|---|
title | string | Episode title |
content | text | Episode teaser/description |
stream_date | date | Scheduled stream date |
stream_time | time | Scheduled stream time |
stream_visibility | select | public/private/unlisted |
automation_mode | select | production/development |
rumble_url | url | Rumble video URL |
rumble_embed | url | Rumble embed URL |
rumble_stream_url | url | RTMP stream URL |
rumble_stream_key | string | RTMP stream key |
youtube_url | url | YouTube video URL |
restream_id | string | Restream event ID |
show_notes | textarea | Full show notes |
Broadcast
Pre-production content before becoming a podcast.
| Field | Type | Description |
|---|---|---|
boxcast_id | string | Boxcast broadcast ID |
boxcast_status | string | Processing status |
boxcast_mp4_url | url | Download URL for video |
boxcast_m4a_url | url | Download URL for audio |
boxcast_poster_url | url | Thumbnail URL |
Guest
Guest information and booking.
| Field | Type | Description |
|---|---|---|
title | string | Guest name |
guest_bio | textarea | Guest biography |
thumbnail | image | Guest photo |
Automation System
Core Components
The automation system is built around a step-based workflow:
Step Registration
Steps are registered using a declarative API:
register_automation_step('rumble', "rumble_setup", [
'meta_field_inputs' => [
'visibility' => "stream_visibility",
'stream_date' => "stream_date",
'stream_time' => "stream_time",
],
'delete_button_meta_key' => 'rumble_embed',
'post_meta_updates' => [...],
'response_fields' => ['rumble_url', 'rumble_embed', 'rumble_stream_url', 'rumble_stream_key'],
'extra_fields' => function($post_id, $post) {
return [
'title' => $post->post_title,
'featured_image' => get_the_post_thumbnail_url($post_id, 'full'),
'content' => $post->post_content
];
},
'cascade_create_steps' => ['generate_shortlink', 'boxcast_integration'],
'disable_if' => function($post_id) { /* ... */ },
'embed_renderer' => function($post_id) { /* ... */ },
]);Available Steps
| Step | Endpoint | Description |
|---|---|---|
rumble_setup | /rumble-create | Create Rumble livestream |
boxcast_integration | /boxcast-update-integration | Update Boxcast RTMP |
generate_shortlink | /shortlink | Create short.io link |
telegram_post | /telegram | Post to Telegram |
twitter_post | /ayrshare-create | Post to Twitter/X |
facebook_post | /ayrshare-create | Post to Facebook |
restream_setup | /restream-create | Create Restream event |
youtube_setup | /youtube-create | Create YouTube Live |
Flow Tracker UI
The Flow Tracker is an admin metabox showing automation status:
┌──────────────────────────────────────────────────────────────┐
│ Automation Flow Tracker │
├──────────────────────────────────────────────────────────────┤
│ 👁 Rumble Setup [Success] ▶️ 🗑 ☑ │
│ 👁 Boxcast Integration [Success] ▶️ 🗑 ☑ │
│ Generate Shortlink [Pending] ▶️ ☑ │
│ Telegram Post [Pending] ▶️ ☑ │
│ Restream Setup [Pending] ▶️ ☑ │
│ YouTube Setup [Pending] ▶️ ☑ │
└──────────────────────────────────────────────────────────────┘Features:
- Status badges — Pending, Success, Failed
- Run button — Execute or re-run individual steps
- Delete button — Delete platform content (when applicable)
- Toggle switches — Enable/disable steps for batch run
- Embed preview — View platform embeds inline
Webhook Buttons
Action buttons are registered dynamically:
register_dynamic_webhook_button([
'post_type' => 'podcast',
'button_id' => 'create-livestreams',
'button_label' => 'Publish Livestreams',
'button_location' => 'post_submitbox_misc_actions',
'processing_label' => '⏳ Publishing...',
'button_class' => 'button button-primary',
'webhook_action' => 'create_livestream',
'prepare_payload' => function($data) { /* ... */ },
'handle_response' => function($payload, $post_id) { /* ... */ },
]);Button Types
| Button | Description |
|---|---|
| Publish Livestreams | Run all enabled automation steps |
| Generate AI Summary | Generate description via OpenAI |
| Headlines | Generate headline variations |
| Short Summary | Create short teaser |
| All Social Posts | Generate all social content |
| Facebook Post | Generate Facebook-specific post |
| Telegram Post | Generate Telegram message |
| Twitter Post | Generate Twitter/X post |
| Convert to Podcast | Convert broadcast to podcast CPT |
AI Integration
The theme integrates with OpenAI for content generation:
register_dynamic_webhook_button([
'button_id' => 'generate-ai-description',
'button_label' => 'Generate AI Summary',
'target_url' => 'https://api.openai.com/v1/chat/completions',
'api_key' => OPENAI_API_KEY,
'prepare_payload' => function ($data) {
$prompt = "Write a short, hard-hitting show description...";
return [
'model' => 'gpt-4',
'messages' => [
['role' => 'user', 'content' => $prompt],
],
'temperature' => 0.7,
];
},
]);Prompt Templates
Stored in includes/automation/prompts/:
| File | Purpose |
|---|---|
universal.txt | General episode description |
teaser.txt | Episode teaser format |
short-teaser.txt | Short social format |
facebook-post.txt | Facebook-specific format |
instructions.txt | Style guidelines |
Boxcast Integration
The theme has deep Boxcast integration for broadcast management:
includes/automation/boxcast/
├── boxcast-core.php # Core loader
├── acf-hooks.php # ACF field hooks
├── ajax.php # AJAX handlers
├── enqueue.php # Script loading
├── iframe-ui.php # Embed rendering
├── api/
│ └── api.php # API client
└── js/ # Frontend scriptsFeatures
- Status polling — Track upload/processing status
- Download URLs — Fetch MP4/M4A download links
- Integration updates — Update RTMP credentials
- Iframe preview — Embed broadcasts in admin
Podcast Sync
The catalog.php file handles Rumble episode synchronization:
Manual Sync
Sync button in podcast list view triggers:
- Fetch episode data from Rumble via X Server
- Update post meta (title, description, views, duration)
- Update post date based on Rumble publish date
- Extract video resolutions
Scheduled Sync
Cron job runs hourly to fetch latest Rumble episodes:
add_action('mia_fetch_rumble_latest_episodes', 'mia_fetch_rumble_latest_episodes_job');Creates new podcast posts for episodes not yet tracked.
Livestream Status
The live.php file checks stream status via Browserless:
function update_stream_status_in_db() {
// Uses Browserless.io to scrape Rumble livestream status
// Returns: Live, Starting Soon, Ended, Offline
}REST API
Podcasts Endpoint
GET /wp-json/automation/v1/podcasts?limit=10Returns:
{
"success": true,
"count": 10,
"data": [
{
"id": 123,
"title": "Episode Title",
"date": "2026-02-05T10:00:00-05:00",
"link": "https://example.com/podcast/episode-title",
"content": "Episode description...",
"featured_image": "https://example.com/image.jpg",
"rumble_url": "https://rumble.com/...",
"rumble_embed": "https://rumble.com/embed/...",
"bunny_id": "abc123"
}
]
}Plugin: Stream Status Bar
A companion plugin for frontend livestream status:
wp-content/plugins/stream-status-bar/
├── stream-status-bar.php # Plugin main file
├── stream-status-bar.js # Frontend script
└── stream-status-bar.css # StylesShortcode
[stream_status_bar]Displays current livestream status with countdown timer.
Environment Configuration
Required constants in wp-config.php:
define('OPENAI_API_KEY', 'sk-...');
define('X_SERVER_URL', 'http://x-server:3000');
define('BOXCAST_YOUTUBE_INTEGRATION_ID', 't8i39wflb8ugjrrcytpe');Integration with X Server
The theme communicates with X Server for platform automation:
// Example: Create Rumble livestream
wp_remote_post(X_SERVER_URL . '/rumble-create', [
'headers' => ['Content-Type' => 'application/json'],
'body' => json_encode([
'title' => $post->post_title,
'content' => $post->post_content,
'featured_image' => get_the_post_thumbnail_url($post_id, 'full'),
'visibility' => 'public',
'stream_date' => '2026-02-05',
'stream_time' => '10:00'
])
]);Related
- X Server — Platform automation server
- Publishing Workflow — End-to-end publishing
- Bridge API — CRM orchestration layer