Skip to content

Commit fb52c74

Browse files
author
Nikola Miljković
committed
Release 2.15.7
2 parents f3e63ae + 97c7b26 commit fb52c74

7 files changed

+70
-27
lines changed

includes/class-sm-shortcodes.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,9 @@ function display_sermons( $atts = array() ) {
922922

923923
$query = new WP_Query( $query_args );
924924

925+
// Add query to the args.
926+
$args['query'] = $query;
927+
925928
// Set image size. Deprecated.
926929
add_filter( 'wpfc_sermon_excerpt_sermon_image_size', function () use ( $args ) {
927930
return $args['image_size'];
@@ -943,7 +946,14 @@ function display_sermons( $atts = array() ) {
943946
$query->the_post();
944947
global $post;
945948

946-
echo apply_filters( 'sm_shortcode_sermons_single_output', '<div class="wpfc-sermon wpfc-sermon-shortcode">' . wpfc_sermon_excerpt_v2( true, $args ) . '</div>', $post );
949+
// Allows preventing the call of wpfc_sermon_excerpt_v2().
950+
if ( apply_filters( 'sm_shortcode_output_override', false ) ) {
951+
$output = '';
952+
} else {
953+
$output = '<div class="wpfc-sermon wpfc-sermon-shortcode">' . wpfc_sermon_excerpt_v2( true, $args ) . '</div>';
954+
}
955+
956+
echo apply_filters( 'sm_shortcode_sermons_single_output', $output, $post, $args );
947957
}
948958
?>
949959
</div>

includes/sm-template-functions.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,16 @@ function wpfc_sermon_meta( $meta_key = '', $before = '', $after = '' ) {
221221
/**
222222
* Return single sermon meta key content from inside a loop.
223223
*
224-
* @param string $meta_key The meta key name.
224+
* @param string $meta_key The meta key name.
225+
* @param WP_Post|null $post The sermon post object.
225226
*
226227
* @return mixed|null The meta key content/null if it's blank.
227228
*/
228-
function get_wpfc_sermon_meta( $meta_key = '' ) {
229-
global $post;
229+
function get_wpfc_sermon_meta( $meta_key = '', $post = null ) {
230+
if ( null === $post ) {
231+
global $post;
232+
}
233+
230234
$data = get_post_meta( $post->ID, $meta_key, true );
231235
if ( '' !== $data ) {
232236
return $data;
@@ -482,11 +486,9 @@ function wpfc_sermon_single_v2( $return = false, $post = null ) {
482486
function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) {
483487
global $post;
484488

485-
if ( empty( $args ) ) {
486-
$args = array(
487-
'image_size' => 'post-thumbnail',
488-
);
489-
}
489+
$args += array(
490+
'image_size' => 'post-thumbnail',
491+
);
490492

491493
// Get the partial.
492494
$output = wpfc_get_partial( 'content-sermon-archive', $args );
@@ -618,8 +620,10 @@ function wpfc_get_term_dropdown( $taxonomy, $default = '' ) {
618620
$terms = array_merge( $ordered_terms, $unordered_terms );
619621
}
620622

623+
$current_slug = get_query_var( $taxonomy ) ?: ( isset( $_GET[ $taxonomy ] ) ? $_GET[ $taxonomy ] : '' );
624+
621625
foreach ( $terms as $term ) {
622-
$html .= '<option value="' . $term->slug . '" ' . ( ( '' === $default ? get_query_var( $taxonomy ) === $term->slug : $term->slug === $default ) ? 'selected' : '' ) . '>' . $term->name . '</option>';
626+
$html .= '<option value="' . $term->slug . '" ' . ( ( '' === $default ? $current_slug === $term->slug : $default === $term->slug ) ? 'selected' : '' ) . '>' . $term->name . '</option>';
623627
}
624628

625629
return $html;

readme.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: church, sermon, sermons, preaching, podcasting, manage, managing, podcasts
55
Requires at least: 4.7.0
66
Tested up to: 4.9
77
Requires PHP: 5.3
8-
Stable tag: 2.15.6
8+
Stable tag: 2.15.7
99
License: GPLv2
1010
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1111

@@ -103,6 +103,10 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
103103
2. Sermon Files
104104

105105
## Changelog ##
106+
### 2.15.7 ###
107+
* Fix: PHP warning when archive output is used wrongly
108+
* Fix: Podcast items may be sorted the wrong way
109+
106110
### 2.15.6 ###
107111
* Change: Disable autocomplete for date preached, since it obstructed the view on mobile
108112
* Fix: Comments not appearing on Divi

sermons.php

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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.

views/partials/content-sermon-archive.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@
1818

1919
global $post;
2020

21-
$args = ! empty( $GLOBALS['wpfc_partial_args'] ) ? $GLOBALS['wpfc_partial_args'] : array(
21+
if ( empty( $GLOBALS['wpfc_partial_args'] ) ) {
22+
$GLOBALS['wpfc_partial_args'] = array();
23+
}
24+
25+
$GLOBALS['wpfc_partial_args'] += array(
2226
'image_size' => 'post-thumbnail',
2327
);
2428

29+
$args = $GLOBALS['wpfc_partial_args'];
30+
2531
?>
2632
<?php if ( ! ( \SermonManager::getOption( 'theme_compatibility' ) || ( defined( 'WPFC_SM_SHORTCODE' ) && WPFC_SM_SHORTCODE === true ) ) ) : ?>
2733
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

views/partials/content-sermon-filtering.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
title="<?php echo $filter['title']; ?>"
5252
id="<?php echo $filter['taxonomy']; ?>"
5353
onchange="if(this.options[this.selectedIndex].value !== ''){return this.form.submit()}else{window.location = '<?php echo $action; ?>';}"
54+
autocomplete="off"
5455
<?php echo ! empty( $args[ $filter['taxonomy'] ] ) && 'disable' === $args['visibility'] ? 'disabled' : ''; ?>>
5556
<option value=""><?php echo $filter['title']; ?></option>
5657
<?php echo wpfc_get_term_dropdown( $filter['taxonomy'], ! empty( $args[ $filter['taxonomy'] ] ) ? $args[ $filter['taxonomy'] ] : '' ); ?>

views/wpfc-podcast-feed.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
'meta_value_num' => time(),
2020
'meta_compare' => '<=',
2121
'orderby' => 'meta_value_num',
22+
'order' => 'DESC',
2223
'paged' => isset( $_GET['paged'] ) ? intval( $_GET['paged'] ) : 1,
2324
'meta_query' => array(
2425
'relation' => 'AND',

0 commit comments

Comments
 (0)