Guide

Spoken Article architecture

Bootstrap wires post type support, a private spoken-article CPT, REST, ElevenLabs clients, schema, admin assets, and player blocks.

Key classes

ClassPathRole
Bootstrapincludes/class-bootstrap.phpLoader, post type support, CLI
Content_Typeincludes/class-content-type.phpPrivate spoken-article CPT
Post_Metaincludes/class-post-meta.phpAudio and play-count meta
Rest_APIincludes/class-rest-api.phpTTS text, ElevenLabs proxy, CPT helpers
ElevenLabs_Settings / ElevenLabs_TTSincludes/API key, models, HTTP TTS
Interstitial_Adsincludes/class-interstitial-ads.phpSettings UI + interstitial REST
Schemaincludes/class-schema.phpAudioObject via prc_schema_seo_post_schema
Generate_Spoken_Articleincludes/ai-experiments/WP Ability prc-spoken-article/generate

Data flow

  1. Text extractionRest_API::get_text_for_tts() prefers prc-markdown-for-agents Markdown conversion; falls back to the_content with tags stripped.
  2. Summarization — When the WordPress AI Client is available, /tts-text can condense copy into a Listener's Digest (~target minutes).
  3. TTS — Editor JS calls POST /elevenlabs/tts. PHP holds PRC_PLATFORM_ELEVENLABS_API_KEY (or the elevenlabs_api_key option). The browser never receives the key.
  4. Storage — Audio lands in the media library; metadata links through the spoken-article CPT / parent meta (attachment_id, audio_url, duration).
  5. Playback — Player blocks render from server-side meta with an Interactivity API store.
Flow

Generate and play

5 relationships
Server-side proxy keeps the ElevenLabs API key out of the browser.

Post type support

Meta registration, sidebar visibility, and schema output key off prc-spoken-article support. Default enabled type: post.

Environment notes

  • In local environments, block PHP may load from src/; otherwise from build/.
  • Play count increment is public (anonymous frontend tracking).
  • Player session state uses sessionStorage key prc-spoken-article-playback (24h expiry).

Dependencies

  • Upstream: prc-schema-seo (AudioObject), optional prc-markdown-for-agents, optional WordPress AI Client
  • External: ElevenLabs TTS API

Was this helpful?