diff --git a/includes/class-sm-shortcodes.php b/includes/class-sm-shortcodes.php
index bae31da..6160524 100755
--- a/includes/class-sm-shortcodes.php
+++ b/includes/class-sm-shortcodes.php
@@ -922,6 +922,9 @@ function display_sermons( $atts = array() ) {
$query = new WP_Query( $query_args );
+ // Add query to the args.
+ $args['query'] = $query;
+
// Set image size. Deprecated.
add_filter( 'wpfc_sermon_excerpt_sermon_image_size', function () use ( $args ) {
return $args['image_size'];
@@ -943,7 +946,14 @@ function display_sermons( $atts = array() ) {
$query->the_post();
global $post;
- echo apply_filters( 'sm_shortcode_sermons_single_output', '
' . wpfc_sermon_excerpt_v2( true, $args ) . '
', $post );
+ // Allows preventing the call of wpfc_sermon_excerpt_v2().
+ if ( apply_filters( 'sm_shortcode_output_override', false ) ) {
+ $output = '';
+ } else {
+ $output = '' . wpfc_sermon_excerpt_v2( true, $args ) . '
';
+ }
+
+ echo apply_filters( 'sm_shortcode_sermons_single_output', $output, $post, $args );
}
?>
diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php
index 41dbdd3..873661a 100755
--- a/includes/sm-template-functions.php
+++ b/includes/sm-template-functions.php
@@ -221,12 +221,16 @@ function wpfc_sermon_meta( $meta_key = '', $before = '', $after = '' ) {
/**
* Return single sermon meta key content from inside a loop.
*
- * @param string $meta_key The meta key name.
+ * @param string $meta_key The meta key name.
+ * @param WP_Post|null $post The sermon post object.
*
* @return mixed|null The meta key content/null if it's blank.
*/
-function get_wpfc_sermon_meta( $meta_key = '' ) {
- global $post;
+function get_wpfc_sermon_meta( $meta_key = '', $post = null ) {
+ if ( null === $post ) {
+ global $post;
+ }
+
$data = get_post_meta( $post->ID, $meta_key, true );
if ( '' !== $data ) {
return $data;
@@ -482,11 +486,9 @@ function wpfc_sermon_single_v2( $return = false, $post = null ) {
function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) {
global $post;
- if ( empty( $args ) ) {
- $args = array(
- 'image_size' => 'post-thumbnail',
- );
- }
+ $args += array(
+ 'image_size' => 'post-thumbnail',
+ );
// Get the partial.
$output = wpfc_get_partial( 'content-sermon-archive', $args );
@@ -618,8 +620,10 @@ function wpfc_get_term_dropdown( $taxonomy, $default = '' ) {
$terms = array_merge( $ordered_terms, $unordered_terms );
}
+ $current_slug = get_query_var( $taxonomy ) ?: ( isset( $_GET[ $taxonomy ] ) ? $_GET[ $taxonomy ] : '' );
+
foreach ( $terms as $term ) {
- $html .= '';
+ $html .= '';
}
return $html;
diff --git a/readme.txt b/readme.txt
index 9f8bd2e..d13b87f 100755
--- a/readme.txt
+++ b/readme.txt
@@ -5,7 +5,7 @@ Tags: church, sermon, sermons, preaching, podcasting, manage, managing, podcasts
Requires at least: 4.7.0
Tested up to: 4.9
Requires PHP: 5.3
-Stable tag: 2.15.6
+Stable tag: 2.15.7
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -103,6 +103,10 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
2. Sermon Files
## Changelog ##
+### 2.15.7 ###
+* Fix: PHP warning when archive output is used wrongly
+* Fix: Podcast items may be sorted the wrong way
+
### 2.15.6 ###
* Change: Disable autocomplete for date preached, since it obstructed the view on mobile
* Fix: Comments not appearing on Divi
diff --git a/sermons.php b/sermons.php
index ca0ea2b..00ec4d7 100755
--- a/sermons.php
+++ b/sermons.php
@@ -3,7 +3,7 @@
* Plugin Name: Sermon Manager for WordPress
* Plugin URI: https://www.wpforchurch.com/products/sermon-manager-for-wordpress/
* Description: Add audio and video sermons, manage speakers, series, and more.
- * Version: 2.15.6
+ * Version: 2.15.7
* Author: WP for Church
* Author URI: https://www.wpforchurch.com/
* Requires at least: 4.5
@@ -81,8 +81,10 @@ public function __construct() {
// Load translations.
add_action( 'after_setup_theme', array( $this, 'load_translations' ) );
- // Enqueue scripts & styles.
+ // Register & enqueue scripts & styles.
+ add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts_styles' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) );
+ add_action( 'wp_footer', array( $this, 'register_scripts_styles' ) );
add_action( 'wp_footer', array( $this, 'enqueue_scripts_styles' ) );
// Append custom classes to individual sermons.
add_filter( 'post_class', array( $this, 'add_additional_sermon_classes' ), 10, 3 );
@@ -553,13 +555,6 @@ public static function enqueue_scripts_styles() {
return;
}
- wp_register_script( 'wpfc-sm-fb-player', SM_URL . 'assets/vendor/js/facebook-video.js', array(), SM_VERSION );
- 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' ) );
- 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 );
- wp_register_script( 'wpfc-sm-verse-script', SM_URL . 'assets/vendor/js/verse.js', array(), SM_VERSION );
- wp_register_style( 'wpfc-sm-styles', SM_URL . 'assets/css/sermon.min.css', array(), SM_VERSION );
- wp_register_style( 'wpfc-sm-plyr-css', SM_URL . 'assets/vendor/css/plyr.min.css', array(), '3.4.3' );
-
if ( ! ( defined( 'SM_ENQUEUE_SCRIPTS_STYLES' ) || 'wpfc_sermon' === get_post_type() || is_post_type_archive( 'wpfc_sermon' ) )
) {
return;
@@ -570,18 +565,14 @@ public static function enqueue_scripts_styles() {
wp_enqueue_style( 'dashicons' );
// Load theme-specific styling, if there's any.
- if ( file_exists( SM_PATH . 'assets/css/theme-specific/' . get_option( 'template' ) . '.css' ) ) {
- 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 );
- }
+ wp_enqueue_style( 'wpfc-sm-style-' . get_option( 'template' ) );
do_action( 'sm_enqueue_css' );
do_action( 'sm_enqueue_js' );
}
// Load top theme-specific styling, if there's any.
- if ( file_exists( get_stylesheet_directory() . '/sermon.css' ) ) {
- wp_enqueue_style( 'wpfc-sm-style-theme', get_stylesheet_directory_uri() . '/sermon.css', array( 'wpfc-sm-styles' ), SM_VERSION );
- }
+ wp_enqueue_style( 'wpfc-sm-style-theme' );
switch ( \SermonManager::getOption( 'player' ) ) {
case 'mediaelement':
@@ -740,6 +731,32 @@ public static function maybe_print_cloudflare_plyr() {
define( 'SM_CLOUDFLARE_DONE', true );
}
+
+ /**
+ * Registers all of the scripts and styles, without enqueueing them.
+ *
+ * It will be removed in future in favor of Script_Manager class.
+ *
+ * @since 2.15.7
+ */
+ public static function register_scripts_styles() {
+ wp_register_script( 'wpfc-sm-fb-player', SM_URL . 'assets/vendor/js/facebook-video.js', array(), SM_VERSION );
+ 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' ) );
+ 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 );
+ wp_register_script( 'wpfc-sm-verse-script', SM_URL . 'assets/vendor/js/verse.js', array(), SM_VERSION );
+ wp_register_style( 'wpfc-sm-styles', SM_URL . 'assets/css/sermon.min.css', array(), SM_VERSION );
+ wp_register_style( 'wpfc-sm-plyr-css', SM_URL . 'assets/vendor/css/plyr.min.css', array(), '3.4.3' );
+
+ // Register theme-specific styling, if there's any.
+ if ( file_exists( SM_PATH . 'assets/css/theme-specific/' . get_option( 'template' ) . '.css' ) ) {
+ 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 );
+ }
+
+ // Register top theme-specific styling, if there's any.
+ if ( file_exists( get_stylesheet_directory() . '/sermon.css' ) ) {
+ wp_register_style( 'wpfc-sm-style-theme', get_stylesheet_directory_uri() . '/sermon.css', array( 'wpfc-sm-styles' ), SM_VERSION );
+ }
+ }
}
// Initialize Sermon Manager.
diff --git a/views/partials/content-sermon-archive.php b/views/partials/content-sermon-archive.php
index c302dfe..935c2b8 100644
--- a/views/partials/content-sermon-archive.php
+++ b/views/partials/content-sermon-archive.php
@@ -18,10 +18,16 @@
global $post;
-$args = ! empty( $GLOBALS['wpfc_partial_args'] ) ? $GLOBALS['wpfc_partial_args'] : array(
+if ( empty( $GLOBALS['wpfc_partial_args'] ) ) {
+ $GLOBALS['wpfc_partial_args'] = array();
+}
+
+$GLOBALS['wpfc_partial_args'] += array(
'image_size' => 'post-thumbnail',
);
+$args = $GLOBALS['wpfc_partial_args'];
+
?>
>
diff --git a/views/partials/content-sermon-filtering.php b/views/partials/content-sermon-filtering.php
index d1e699a..a511132 100644
--- a/views/partials/content-sermon-filtering.php
+++ b/views/partials/content-sermon-filtering.php
@@ -51,6 +51,7 @@
title=""
id=""
onchange="if(this.options[this.selectedIndex].value !== ''){return this.form.submit()}else{window.location = '';}"
+ autocomplete="off"
>
diff --git a/views/wpfc-podcast-feed.php b/views/wpfc-podcast-feed.php
index 6e0e2ab..c4ec5c7 100644
--- a/views/wpfc-podcast-feed.php
+++ b/views/wpfc-podcast-feed.php
@@ -19,6 +19,7 @@
'meta_value_num' => time(),
'meta_compare' => '<=',
'orderby' => 'meta_value_num',
+ 'order' => 'DESC',
'paged' => isset( $_GET['paged'] ) ? intval( $_GET['paged'] ) : 1,
'meta_query' => array(
'relation' => 'AND',