' . __( 'Download Files', 'sermon-manager' ) . '';
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
+ // skip audio, so we don't have double URLs
+ if ( get_wpfc_sermon_meta( 'sermon_audio' ) === wp_get_attachment_url( $attachment->ID ) ) {
+ continue;
+ }
+
$html .= '
';
$html .= $attachment->post_title;
}
@@ -626,7 +631,7 @@ function wpfc_sermon_time_filter( $the_time = 0, $d = '', $post = null ) {
*/
function wpfc_sermon_date_filter( $the_date = 0, $d = '', $post = null ) {
// if the post is not set, try to get current one
- if ( $post === null ) {
+ if ( ! is_single() && $post === null ) {
$post = the_post();
}
diff --git a/readme.txt b/readme.txt
index 37c72e7..7ecdd17 100755
--- a/readme.txt
+++ b/readme.txt
@@ -3,8 +3,8 @@ Contributors: wpforchurch
Donate link: http://wpforchurch.com/
Tags: church, sermon, sermons, preaching, podcasting
Requires at least: 3.6
-Tested up to: 4.7.5
-Stable tag: 2.4.1
+Tested up to: 4.8.0
+Stable tag: 2.4.2
Add audio and video sermons, manage speakers, series, and more to your church website.
@@ -83,6 +83,15 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
2. Sermon Files
== Changelog ==
+= 2.4.3 =
+* Fix Sermon Manager interfering with regular post dates under some circumstances
+* Fix fatal error when using UpdraftPlus
+* Fix fatal error for longtime Sermon Manager users (thank you <3)
+* Fix audio URL duplication in "Download Files" section
+* Fix date checking URL
+* Fix scripts and styles not loading when shortcode is used in ordinary posts
+* Fix new player styles not loading
+
= 2.4.1 =
* Fix fatal error for podcasts
diff --git a/sermons.php b/sermons.php
index 8f06b12..9eccfc5 100755
--- a/sermons.php
+++ b/sermons.php
@@ -3,7 +3,7 @@
Plugin Name: Sermon Manager for WordPress
Plugin URI: http://www.wpforchurch.com/products/sermon-manager-for-wordpress/
Description: Add audio and video sermons, manage speakers, series, and more. Visit Wordpress for Church for tutorials and support.
-Version: 2.4.1
+Version: 2.4.2
Author: WP for Church
Contributors: wpforchurch, jprummer, jamzth
Author URI: http://www.wpforchurch.com/
@@ -73,10 +73,8 @@ private function includes() {
*/
$includes = array(
'/includes/legacy-php.php', // Old PHP compatibility fixes
- '/includes/CMB2/init.php', // Metaboxes
'/includes/types-taxonomies.php', // Post Types and Taxonomies
'/includes/taxonomy-images/taxonomy-images.php', // Images for Custom Taxonomies
- '/includes/options.php', // Options Page
'/includes/entry-views.php', // Entry Views Tracking
'/includes/shortcodes.php', // Shortcodes
'/includes/widgets.php', // Widgets
@@ -89,8 +87,10 @@ private function includes() {
* Admin only includes
*/
$admin_includes = array(
- '/includes/admin-functions.php',
- '/includes/fix-dates.php',
+ '/includes/admin-functions.php', // General Admin area functions
+ '/includes/fix-dates.php', // Date fixing, explained in the script
+ '/includes/CMB2/init.php', // Metaboxes
+ '/includes/options.php', // Options Page
);
// Load files
@@ -141,7 +141,27 @@ public static function load_translations() {
*/
public static function enqueue_scripts_styles() {
- if ( 'wpfc_sermon' === get_post_type() ) {
+ global $wp_query;
+
+ // we will check all the posts in the query if they have sermons shortcode
+ $has_shortcode = false;
+ if ( ! empty( $wp_query->posts ) ) {
+ foreach ( $wp_query->posts as $post ) {
+ if ( ! empty( $post->post_content ) ) {
+ $has_shortcode = has_shortcode( $post->post_content, 'sermons' ) ||
+ has_shortcode( $post->post_content, 'list_sermons' ) ||
+ has_shortcode( $post->post_content, 'sermon_images' ) ||
+ has_shortcode( $post->post_content, 'latest_series' ) ||
+ has_shortcode( $post->post_content, 'sermon_sort_fields' );
+
+ if ( $has_shortcode === true ) {
+ break;
+ }
+ }
+ }
+ }
+
+ if ( 'wpfc_sermon' === get_post_type() || $has_shortcode ) {
if ( ! \SermonManager::getOption( 'bibly' ) ) {
wp_enqueue_script( 'bibly-script', SERMON_MANAGER_URL . 'js/bibly.min.js', array(), SERMON_MANAGER_VERSION );
wp_enqueue_style( 'bibly-style', SERMON_MANAGER_URL . 'css/bibly.min.css', array(), SERMON_MANAGER_VERSION );
@@ -158,7 +178,7 @@ public static function enqueue_scripts_styles() {
if ( ! \SermonManager::getOption( 'css' ) ) {
wp_enqueue_style( 'sermon-styles', SERMON_MANAGER_URL . 'css/sermon.css', array(), SERMON_MANAGER_VERSION );
- if ( \SermonManager::getOption( 'use_old_player' ) ) {
+ if ( ! \SermonManager::getOption( 'use_old_player' ) ) {
wp_enqueue_script( 'sermon-manager-plyr', SERMON_MANAGER_URL . 'js/plyr.js', array(), SERMON_MANAGER_VERSION );
wp_enqueue_style( 'sermon-manager-plyr-css', SERMON_MANAGER_URL . 'css/plyr.css', array(), SERMON_MANAGER_VERSION );
wp_add_inline_script( 'sermon-manager-plyr', 'window.onload=function(){plyr.setup(document.querySelectorAll(\'.wpfc-sermon-player\'));}' );