33 * Plugin Name: Sermon Manager for WordPress
44 * Plugin URI: https://www.wpforchurch.com/products/sermon-manager-for-wordpress/
55 * Description: Add audio and video sermons, manage speakers, series, and more.
6- * Version: 2.15.6
6+ * Version: 2.15.7
77 * Author: WP for Church
88 * Author URI: https://www.wpforchurch.com/
99 * Requires at least: 4.5
@@ -81,8 +81,10 @@ public function __construct() {
8181
8282 // Load translations.
8383 add_action ( 'after_setup_theme ' , array ( $ this , 'load_translations ' ) );
84- // Enqueue scripts & styles.
84+ // Register & enqueue scripts & styles.
85+ add_action ( 'wp_enqueue_scripts ' , array ( $ this , 'register_scripts_styles ' ) );
8586 add_action ( 'wp_enqueue_scripts ' , array ( $ this , 'enqueue_scripts_styles ' ) );
87+ add_action ( 'wp_footer ' , array ( $ this , 'register_scripts_styles ' ) );
8688 add_action ( 'wp_footer ' , array ( $ this , 'enqueue_scripts_styles ' ) );
8789 // Append custom classes to individual sermons.
8890 add_filter ( 'post_class ' , array ( $ this , 'add_additional_sermon_classes ' ), 10 , 3 );
@@ -553,13 +555,6 @@ public static function enqueue_scripts_styles() {
553555 return ;
554556 }
555557
556- wp_register_script ( 'wpfc-sm-fb-player ' , SM_URL . 'assets/vendor/js/facebook-video.js ' , array (), SM_VERSION );
557- wp_register_script ( 'wpfc-sm-plyr ' , SM_URL . 'assets/vendor/js/plyr.polyfilled ' . ( ( defined ( 'WP_DEBUG ' ) && WP_DEBUG === true ) ? '' : '.min ' ) . '.js ' , array (), '3.4.3 ' , \SermonManager::getOption ( 'player_js_footer ' ) );
558- wp_register_script ( 'wpfc-sm-plyr-loader ' , SM_URL . 'assets/js/plyr ' . ( ( defined ( 'WP_DEBUG ' ) && WP_DEBUG === true ) ? '' : '.min ' ) . '.js ' , array ( 'wpfc-sm-plyr ' ), SM_VERSION );
559- wp_register_script ( 'wpfc-sm-verse-script ' , SM_URL . 'assets/vendor/js/verse.js ' , array (), SM_VERSION );
560- wp_register_style ( 'wpfc-sm-styles ' , SM_URL . 'assets/css/sermon.min.css ' , array (), SM_VERSION );
561- wp_register_style ( 'wpfc-sm-plyr-css ' , SM_URL . 'assets/vendor/css/plyr.min.css ' , array (), '3.4.3 ' );
562-
563558 if ( ! ( defined ( 'SM_ENQUEUE_SCRIPTS_STYLES ' ) || 'wpfc_sermon ' === get_post_type () || is_post_type_archive ( 'wpfc_sermon ' ) )
564559 ) {
565560 return ;
@@ -570,18 +565,14 @@ public static function enqueue_scripts_styles() {
570565 wp_enqueue_style ( 'dashicons ' );
571566
572567 // Load theme-specific styling, if there's any.
573- if ( file_exists ( SM_PATH . 'assets/css/theme-specific/ ' . get_option ( 'template ' ) . '.css ' ) ) {
574- wp_enqueue_style ( 'wpfc-sm-style- ' . get_option ( 'template ' ), SM_URL . 'assets/css/theme-specific/ ' . get_option ( 'template ' ) . '.css ' , array ( 'wpfc-sm-styles ' ), SM_VERSION );
575- }
568+ wp_enqueue_style ( 'wpfc-sm-style- ' . get_option ( 'template ' ) );
576569
577570 do_action ( 'sm_enqueue_css ' );
578571 do_action ( 'sm_enqueue_js ' );
579572 }
580573
581574 // Load top theme-specific styling, if there's any.
582- if ( file_exists ( get_stylesheet_directory () . '/sermon.css ' ) ) {
583- wp_enqueue_style ( 'wpfc-sm-style-theme ' , get_stylesheet_directory_uri () . '/sermon.css ' , array ( 'wpfc-sm-styles ' ), SM_VERSION );
584- }
575+ wp_enqueue_style ( 'wpfc-sm-style-theme ' );
585576
586577 switch ( \SermonManager::getOption ( 'player ' ) ) {
587578 case 'mediaelement ' :
@@ -740,6 +731,32 @@ public static function maybe_print_cloudflare_plyr() {
740731
741732 define ( 'SM_CLOUDFLARE_DONE ' , true );
742733 }
734+
735+ /**
736+ * Registers all of the scripts and styles, without enqueueing them.
737+ *
738+ * It will be removed in future in favor of Script_Manager class.
739+ *
740+ * @since 2.15.7
741+ */
742+ public static function register_scripts_styles () {
743+ wp_register_script ( 'wpfc-sm-fb-player ' , SM_URL . 'assets/vendor/js/facebook-video.js ' , array (), SM_VERSION );
744+ wp_register_script ( 'wpfc-sm-plyr ' , SM_URL . 'assets/vendor/js/plyr.polyfilled ' . ( ( defined ( 'WP_DEBUG ' ) && WP_DEBUG === true ) ? '' : '.min ' ) . '.js ' , array (), '3.4.3 ' , \SermonManager::getOption ( 'player_js_footer ' ) );
745+ wp_register_script ( 'wpfc-sm-plyr-loader ' , SM_URL . 'assets/js/plyr ' . ( ( defined ( 'WP_DEBUG ' ) && WP_DEBUG === true ) ? '' : '.min ' ) . '.js ' , array ( 'wpfc-sm-plyr ' ), SM_VERSION );
746+ wp_register_script ( 'wpfc-sm-verse-script ' , SM_URL . 'assets/vendor/js/verse.js ' , array (), SM_VERSION );
747+ wp_register_style ( 'wpfc-sm-styles ' , SM_URL . 'assets/css/sermon.min.css ' , array (), SM_VERSION );
748+ wp_register_style ( 'wpfc-sm-plyr-css ' , SM_URL . 'assets/vendor/css/plyr.min.css ' , array (), '3.4.3 ' );
749+
750+ // Register theme-specific styling, if there's any.
751+ if ( file_exists ( SM_PATH . 'assets/css/theme-specific/ ' . get_option ( 'template ' ) . '.css ' ) ) {
752+ wp_register_style ( 'wpfc-sm-style- ' . get_option ( 'template ' ), SM_URL . 'assets/css/theme-specific/ ' . get_option ( 'template ' ) . '.css ' , array ( 'wpfc-sm-styles ' ), SM_VERSION );
753+ }
754+
755+ // Register top theme-specific styling, if there's any.
756+ if ( file_exists ( get_stylesheet_directory () . '/sermon.css ' ) ) {
757+ wp_register_style ( 'wpfc-sm-style-theme ' , get_stylesheet_directory_uri () . '/sermon.css ' , array ( 'wpfc-sm-styles ' ), SM_VERSION );
758+ }
759+ }
743760}
744761
745762// Initialize Sermon Manager.
0 commit comments