Skip to content

Commit a460565

Browse files
author
Nikola Miljković
committed
Release 2.15.10
2 parents 99009d6 + 7f5f525 commit a460565

7 files changed

Lines changed: 59 additions & 12 deletions

File tree

includes/admin/settings/class-sm-settings-debug.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ public function get_settings() {
167167
'id' => 'disable_layouts',
168168
'default' => 'no',
169169
),
170+
array(
171+
'title' => __( 'Force Plugin Views', 'sermon-manager-for-wordpress' ),
172+
'type' => 'checkbox',
173+
'desc' => __( 'Force plugin views.', 'sermon-manager-for-wordpress' ),
174+
'desc_tip' => __( 'Forces loading of Sermon Manager views, while overriding theme overrides.', 'sermon-manager-for-wordpress' ),
175+
'id' => 'force_layouts',
176+
'default' => 'no',
177+
),
170178

171179
array(
172180
'type' => 'sectionend',

includes/class-sm-shortcodes.php

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -773,14 +773,17 @@ function display_sermons( $atts = array() ) {
773773
'hide_series' => '',
774774
'hide_preachers' => '',
775775
'hide_books' => '',
776+
'include' => '',
777+
'exclude' => '',
776778
'hide_service_types' => \SermonManager::getOption( 'service_type_filtering' ) ? '' : 'yes',
777779
);
778780

779781
// Legacy convert.
780782
$old_options = array(
781783
'posts_per_page' => 'per_page',
782-
'id' => 'sermons',
783-
'sermon' => 'sermons',
784+
'id' => 'include',
785+
'sermon' => 'include',
786+
'sermons' => 'include',
784787
'hide_nav' => 'hide_pagination',
785788
'taxonomy' => 'filter_by',
786789
'tax_term' => 'filter_value',
@@ -803,7 +806,7 @@ function display_sermons( $atts = array() ) {
803806
'hide_series' => $args['hide_series'],
804807
'hide_preachers' => $args['hide_preachers'],
805808
'hide_books' => $args['hide_books'],
806-
'hide_service_types' => $args['hide_service_type'],
809+
'hide_service_types' => $args['hide_service_types'],
807810
);
808811

809812
// Set query args.
@@ -844,8 +847,8 @@ function display_sermons( $atts = array() ) {
844847
$query_args['orderby'] = $args['orderby'];
845848

846849
// If we should show just specific sermons.
847-
if ( $args['sermons'] ) {
848-
$posts_in = explode( ',', $args['sermons'] );
850+
if ( $args['include'] ) {
851+
$posts_in = explode( ',', $args['include'] );
849852

850853
if ( ! empty( $posts_in ) ) {
851854
foreach ( $posts_in as &$post_in ) {
@@ -863,6 +866,25 @@ function display_sermons( $atts = array() ) {
863866
}
864867
}
865868

869+
if ( $args['exclude'] ) {
870+
$posts_in = explode( ',', $args['exclude'] );
871+
872+
if ( ! empty( $posts_in ) ) {
873+
foreach ( $posts_in as &$post_in ) {
874+
// Remove if it's not an ID.
875+
if ( ! is_numeric( trim( $post_in ) ) ) {
876+
unset( $post_in );
877+
continue;
878+
}
879+
880+
// Convert to int.
881+
$posts_in = intval( trim( $post_in ) );
882+
}
883+
884+
$query_args['post__not_in'] = (array) $posts_in;
885+
}
886+
}
887+
866888
// If we should filter by something.
867889
if ( $args['filter_by'] && $args['filter_value'] ) {
868890
// Term string to array.

includes/sm-template-functions.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
if ( ! \SermonManager::getOption( 'theme_compatibility' ) ) {
1616
add_filter( 'template_include', function ( $template ) {
17-
return sm_get_views_path($template);
17+
return sm_get_views_path( $template );
1818
} );
1919
}
2020

@@ -687,7 +687,9 @@ function wpfc_get_partial( $name = '', $args = array() ) {
687687
*
688688
* @since 2.13.4
689689
*/
690-
function sm_get_views_path( $template = '' ){
690+
function sm_get_views_path( $template = '' ) {
691+
$force_views = SermonManager::getOption( 'force_layouts' );
692+
691693
if ( is_singular( 'wpfc_sermon' ) ) {
692694
$default_file = 'single-wpfc_sermon.php';
693695
} elseif ( is_tax( get_object_taxonomies( 'wpfc_sermon' ) ) ) {
@@ -702,7 +704,7 @@ function sm_get_views_path( $template = '' ){
702704
) ) ) {
703705
$default_file = 'taxonomy-' . $term->taxonomy . '.php';
704706

705-
if ( ! file_exists( get_stylesheet_directory() . '/' . $default_file ) ) {
707+
if ( ! file_exists( get_stylesheet_directory() . '/' . $default_file ) && ! $force_views ) {
706708
$default_file = 'archive-wpfc_sermon.php';
707709
}
708710
} else {
@@ -715,7 +717,7 @@ function sm_get_views_path( $template = '' ){
715717
}
716718

717719
if ( $default_file ) {
718-
if ( file_exists( get_stylesheet_directory() . '/' . $default_file ) ) {
720+
if ( file_exists( get_stylesheet_directory() . '/' . $default_file ) && ! $force_views ) {
719721
return get_stylesheet_directory() . '/' . $default_file;
720722
}
721723

readme.txt

Lines changed: 7 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.9
8+
Stable tag: 2.15.10
99
License: GPLv2
1010
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1111

@@ -122,6 +122,12 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
122122
2. Sermon Files
123123

124124
## Changelog ##
125+
### 2.15.10 ###
126+
* Change: Add "include" and "exclude" parameters to the shortcode
127+
* Change: Add an option to force loading plugin views
128+
* Fix: Edge case PHP bug in feed with taxonomy
129+
* Fix: Notice when using shortcode
130+
125131
### 2.15.9 ###
126132
* New: Add support for Hueman and Hueman Pro themes
127133
* New: Add support for NativeChurch theme

sermons.php

Lines changed: 1 addition & 1 deletion
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.9
6+
* Version: 2.15.10
77
* Author: WP for Church
88
* Author URI: https://www.wpforchurch.com/
99
* Requires at least: 4.5

views/single-wpfc_sermon.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
}
2525

2626
if ( comments_open() || get_comments_number() ) :
27-
comments_template();
27+
if ( ! apply_filters( 'single-wpfc_sermon-disable-comments', false ) ) {
28+
comments_template();
29+
}
2830
endif;
2931
endwhile;
3032

views/wpfc-podcast-feed.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@
106106
'terms' => $term,
107107
),
108108
);
109+
110+
// Append term name to the feed title, so it looks like "Feed Name - Term Name".
111+
$settings['title'] = single_term_title( $settings['title'] . ' - ', false );
109112
}
110113

111114
/**
@@ -129,6 +132,10 @@
129132
// Override the default tax_query for that taxonomy.
130133
if ( ! empty( $args['tax_query'] ) ) {
131134
foreach ( $args['tax_query'] as $id => $arg ) {
135+
if ( ! is_array( $arg ) ) {
136+
continue;
137+
}
138+
132139
if ( $arg['taxonomy'] === $taxonomy ) {
133140
unset( $args['tax_query'][ $id ] );
134141
}

0 commit comments

Comments
 (0)