=== Tushiyah Sermon Audio Manager ===
Contributors: donchen1
Tags: sermons, church, audio, playlist, topics
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.2
Stable tag: 1.9.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manage audio sermons with topics, speakers and series. Topics can hold any number of audio messages.

== Description ==

Tushiyah Sermon Audio Manager adds a Sermon post type with a drag-and-drop audio manager so one sermon can contain multiple audio files (rendered as a native WordPress playlist), plus a hierarchical **Topics** taxonomy designed for topics that group many audio messages — a topic archive lists every sermon and its player automatically.

Features:

* **Sermons** post type with featured image, excerpt and revisions.
* **Multiple audio files per sermon** via the Media Library, sortable by drag and drop.
* **External audio URLs** — paste a link to files hosted anywhere (podcast host, S3/R2, CDN) so long sermons bypass upload-size limits entirely.
* **Topics** taxonomy (hierarchical) — one topic can contain unlimited audio messages across many sermons.
* **Speakers** and **Series** taxonomies included.
* **Listen or download** — every audio gets a player plus a download link (both toggleable).
* **Dashboard display controls** — under Sermons > Settings, choose exactly which details appear (date, speaker, series, scripture, topics, author) on single sermons and archive cards, where the player sits, and whether output is injected automatically or placed manually.
* **Search** — `[tushse_sermon_search]` shortcode with keyword, topic and speaker filters, plus automatic integration with the default WordPress search (including scripture references).
* Works with any theme: output is injected into your theme's normal rendering (classic and block themes). No template overrides needed.
* Shortcodes:
  * `[tushse_sermons topic="faith" limit="10"]` — list sermons, optionally filtered by topic, speaker or series.
  * `[tushse_sermon id="123"]` — display a single sermon with its player(s).
  * `[tushse_sermon_topics]` — list all topics.
  * `[tushse_sermon_search]` — sermon search form with results.
* Admin list table columns for audio count, date preached, speaker, topics and series, plus a topic filter dropdown.
* Optional data removal on uninstall (opt-in on the settings page).
* Translation ready; no external requests, no tracking.

== Installation ==

1. Upload the `tushiyah-sermon-audio-manager` folder to `/wp-content/plugins/`, or install the zip via Plugins > Add New > Upload Plugin.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **Sermons > Add New**, attach audio files from your Media Library, and assign Topics.
4. Use `[tushse_sermon_topics]`, `[tushse_sermons]` or `[tushse_sermon_search]` in any page, or just link visitors to `yoursite.com/topics/<topic-slug>/`.
5. After activating, visit **Settings > Permalinks** and click "Save Changes" once so sermon links resolve.

== Frequently Asked Questions ==

= How do I put multiple audio files under one topic? =

Create a Topic (Sermons > Topics), then assign as many sermons to it as you like. Every sermon can itself carry multiple audio files. The topic archive page lists every sermon in that topic together with its audio player(s). You can also use `[tushse_sermons topic="your-topic-slug"]` anywhere.

= Can one sermon have more than one audio file? =

Yes. Click "Add from Library" and select several files, or paste an "External URL" for files hosted elsewhere. Multiple library files use the built-in WordPress playlist; anything else gets a simple player per file.

= Can I customize how sermons look on single pages and archives? =

Yes — the plugin injects the meta line and player(s) into your theme's normal output via `the_content` / `the_excerpt`, so any theme works. To customize further, use the `tushse_single_head_html` filter (single sermon heading block) or copy `render_item()` markup patterns from `includes/class-tushse-templates.php`.

= How do visitors search sermons? =

Add `[tushse_sermon_search]` to any page: it renders a keyword field plus topic and speaker dropdowns, with paginated results. Sermons also appear in your theme's default site search, where keywords match titles, content, scripture references and topic/speaker/series names.

= How do download links work? =

Each audio shows a Download link next to its player. Media Library files download directly; external URLs open in a new tab (browsers decide whether to play or save based on the host's headers).

= WordPress says my sermon file is too large to upload. What can I do? =

Three options, in order of preference:

1. **Host it externally and paste the URL.** In the Sermon Audio box use "Add External URL" and point to the file on a podcast host, S3/R2 bucket, Bunny/Cloudflare CDN, etc. No size limit applies, your server stays fast, and playback works exactly the same.
2. **Re-encode for speech.** Spoken word compresses extremely well: export mono MP3 at 64-96 kbps in Audacity/Audition and a 1-hour sermon drops from ~100 MB+ to roughly 30-45 MB.
3. **Raise the upload limit.** Set `upload_max_filesize` and `post_max_size` (e.g. 256M) plus `max_execution_time` in your `php.ini`, `.htaccess` (`php_value upload_max_filesize 256M` etc.), or via your host's control panel. Note these are per-directory PHP settings — many shared hosts cap them anyway, which is why option 1 is recommended.

= Where are my audio files stored? =

In your regular WordPress Media Library. The plugin stores attachment IDs only, so URLs keep working if you move domains or CDNs. External URLs are stored as validated http(s) links; nothing is copied or proxied by the plugin.

== Screenshots ==
1. Sermon listed for specific topic in descending order and in grid view
2. WP admin, add sermon option with meta boxes to fill in and settings on right side
3. All Sermons View in wordpress admin
4. Individual audio with transcript

== Changelog ==
= 1.9.2 =
* Security: output is escaped at the echo point (wp_kses_post) for meta lines and pagination, and the script-bearing audio player output follows the WordPress "except when you can't" safe-HTML pattern.
* Rename: all element prefixes changed from sam/SAM to the required 4+ character tushse/TUSHSE (post type, taxonomies, options, meta keys, shortcodes, blocks, CSS/JS handles). Plugin renamed to "Tushiyah Sermon Audio Manager".
* Fixed: block editor script dependency corrected to the registered core handle wp-server-side-render.

= 1.9.1 =
* Added: [tushse_term_title], [tushse_term_image] and [tushse_term_description] shortcodes that pull the current topic/speaker/series into your Divi Theme Builder archive layouts.

= 1.9.0 =
* Fixed: [tushse_sermons] now auto-filters to the current term on topic/speaker/series archive pages (new auto attribute, default yes) - place it in a Divi Theme Builder archive template and it lists only that speaker/topic/series.

= 1.8.8 =
* Changed: Default ordering for [tushse_sermons] is now preached date (sermon date) instead of post published date. Added orderby/order controls to the widget (default: sermon date, newest first).

= 1.8.7 =
* Fixed: On Divi themes, audio players now render as native HTML5 <audio> elements, bypassing wp_playlist_shortcode() / wp_audio_shortcode() which enqueue MediaElement scripts that conflict with Divi's et_pb_init_audio_modules.

= 1.8.6 =
* Fixed: disabled wp-mediaelement on Divi sites where it double-initialized alongside Divi's own copy and broke et_pb_init_audio_modules.

= 1.8.5 =
* Fixed: MediaElement assets are skipped on Divi themes to prevent double-initialization that broke layout on pages with audio players.

= 1.8.4 =
* Fixed: MediaElement assets are only enqueued when a player is actually present, resolving conflicts with Divi's et_pb_init_audio_modules on pages with no audio players.

= 1.8.3 =
* Improved: full WordPress Plugin Check (PCP) compliance - escaping, sanitization, nonces, textdomain handling and a prohibited query flag.

= 1.8.2 =
* Fixed: the search form stayed visible after submitting a search.

= 1.8.1 =
* Fixed: [tushse_sermon_search topic="..."] no longer hides its form on first page load.

= 1.8.0 =
* Added: `topic` attribute for [tushse_sermon_search] to pin a search form to a single topic.

= 1.7.6 =
* Fixed: [tushse_sermon_search] no longer steals an open output buffer when returning early on search requests.

= 1.7.5 =
* Fixed: MediaElement assets enqueued in the page head to avoid a race with theme layout scripts.

= 1.7.4 =
* Fixed: single-file players on non-sermon pages now load the MediaElement stylesheet/script.

= 1.7.3 =
* Fixed: PHP notice "_load_textdomain_just_in_time was called incorrectly" on WordPress 6.7+ from the Recent Sermons widget.

Full history is available in changelog.txt.

== Upgrade Notice ==

= 1.8.2 =
Search form now stays visible after searching, so visitors can refine or start over.

= 1.3.0 =
Dashboard display controls, player placement options, and a Manual fallback if players don't appear in your theme.

= 1.2.0 =
Theme compatibility fix for blank sermon pages, plus download links and sermon search.

= 1.1.0 =
Adds external audio URLs so long sermons no longer hit upload-size limits.

= 1.0.0 =
Initial release.

