From 9f1392373a5000c4c8d3068e381f361b49f8b634 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Mon, 5 Feb 2024 16:23:34 -0700 Subject: [PATCH] Ensure the audio controls render for non-logged in users. Ensure the dashicon font is loaded so the play and pause buttons render --- includes/Classifai/Features/TextToSpeech.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/Classifai/Features/TextToSpeech.php b/includes/Classifai/Features/TextToSpeech.php index c8a81612b..d0fdcf779 100644 --- a/includes/Classifai/Features/TextToSpeech.php +++ b/includes/Classifai/Features/TextToSpeech.php @@ -66,6 +66,10 @@ public function __construct() { public function setup() { parent::setup(); add_action( 'rest_api_init', [ $this, 'register_endpoints' ] ); + + if ( $this->is_enabled() ) { + add_filter( 'the_content', [ $this, 'render_post_audio_controls' ] ); + } } /** @@ -81,10 +85,6 @@ public function feature_setup() { add_action( 'add_meta_boxes', [ $this, 'add_meta_box' ] ); add_action( 'save_post', [ $this, 'save_post_metadata' ], 5 ); - - if ( $this->is_enabled() ) { - add_filter( 'the_content', [ $this, 'render_post_audio_controls' ] ); - } } /** @@ -621,7 +621,7 @@ public function render_post_audio_controls( string $content ): string { wp_enqueue_style( 'classifai-post-audio-player-css', CLASSIFAI_PLUGIN_URL . 'dist/post-audio-controls.css', - array(), + array( 'dashicons' ), get_asset_info( 'post-audio-controls', 'version' ), 'all' );