Skip to content

Commit

Permalink
Release 2.15.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola Miljković committed Nov 30, 2018
2 parents 99009d6 + 7f5f525 commit a460565
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 12 deletions.
8 changes: 8 additions & 0 deletions includes/admin/settings/class-sm-settings-debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ public function get_settings() {
'id' => 'disable_layouts',
'default' => 'no',
),
array(
'title' => __( 'Force Plugin Views', 'sermon-manager-for-wordpress' ),
'type' => 'checkbox',
'desc' => __( 'Force plugin views.', 'sermon-manager-for-wordpress' ),
'desc_tip' => __( 'Forces loading of Sermon Manager views, while overriding theme overrides.', 'sermon-manager-for-wordpress' ),
'id' => 'force_layouts',
'default' => 'no',
),

array(
'type' => 'sectionend',
Expand Down
32 changes: 27 additions & 5 deletions includes/class-sm-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -773,14 +773,17 @@ function display_sermons( $atts = array() ) {
'hide_series' => '',
'hide_preachers' => '',
'hide_books' => '',
'include' => '',
'exclude' => '',
'hide_service_types' => \SermonManager::getOption( 'service_type_filtering' ) ? '' : 'yes',
);

// Legacy convert.
$old_options = array(
'posts_per_page' => 'per_page',
'id' => 'sermons',
'sermon' => 'sermons',
'id' => 'include',
'sermon' => 'include',
'sermons' => 'include',
'hide_nav' => 'hide_pagination',
'taxonomy' => 'filter_by',
'tax_term' => 'filter_value',
Expand All @@ -803,7 +806,7 @@ function display_sermons( $atts = array() ) {
'hide_series' => $args['hide_series'],
'hide_preachers' => $args['hide_preachers'],
'hide_books' => $args['hide_books'],
'hide_service_types' => $args['hide_service_type'],
'hide_service_types' => $args['hide_service_types'],
);

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

// If we should show just specific sermons.
if ( $args['sermons'] ) {
$posts_in = explode( ',', $args['sermons'] );
if ( $args['include'] ) {
$posts_in = explode( ',', $args['include'] );

if ( ! empty( $posts_in ) ) {
foreach ( $posts_in as &$post_in ) {
Expand All @@ -863,6 +866,25 @@ function display_sermons( $atts = array() ) {
}
}

if ( $args['exclude'] ) {
$posts_in = explode( ',', $args['exclude'] );

if ( ! empty( $posts_in ) ) {
foreach ( $posts_in as &$post_in ) {
// Remove if it's not an ID.
if ( ! is_numeric( trim( $post_in ) ) ) {
unset( $post_in );
continue;
}

// Convert to int.
$posts_in = intval( trim( $post_in ) );
}

$query_args['post__not_in'] = (array) $posts_in;
}
}

// If we should filter by something.
if ( $args['filter_by'] && $args['filter_value'] ) {
// Term string to array.
Expand Down
10 changes: 6 additions & 4 deletions includes/sm-template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
if ( ! \SermonManager::getOption( 'theme_compatibility' ) ) {
add_filter( 'template_include', function ( $template ) {
return sm_get_views_path($template);
return sm_get_views_path( $template );
} );
}

Expand Down Expand Up @@ -687,7 +687,9 @@ function wpfc_get_partial( $name = '', $args = array() ) {
*
* @since 2.13.4
*/
function sm_get_views_path( $template = '' ){
function sm_get_views_path( $template = '' ) {
$force_views = SermonManager::getOption( 'force_layouts' );

if ( is_singular( 'wpfc_sermon' ) ) {
$default_file = 'single-wpfc_sermon.php';
} elseif ( is_tax( get_object_taxonomies( 'wpfc_sermon' ) ) ) {
Expand All @@ -702,7 +704,7 @@ function sm_get_views_path( $template = '' ){
) ) ) {
$default_file = 'taxonomy-' . $term->taxonomy . '.php';

if ( ! file_exists( get_stylesheet_directory() . '/' . $default_file ) ) {
if ( ! file_exists( get_stylesheet_directory() . '/' . $default_file ) && ! $force_views ) {
$default_file = 'archive-wpfc_sermon.php';
}
} else {
Expand All @@ -715,7 +717,7 @@ function sm_get_views_path( $template = '' ){
}

if ( $default_file ) {
if ( file_exists( get_stylesheet_directory() . '/' . $default_file ) ) {
if ( file_exists( get_stylesheet_directory() . '/' . $default_file ) && ! $force_views ) {
return get_stylesheet_directory() . '/' . $default_file;
}

Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.9
Stable tag: 2.15.10
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

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

## Changelog ##
### 2.15.10 ###
* Change: Add "include" and "exclude" parameters to the shortcode
* Change: Add an option to force loading plugin views
* Fix: Edge case PHP bug in feed with taxonomy
* Fix: Notice when using shortcode

### 2.15.9 ###
* New: Add support for Hueman and Hueman Pro themes
* New: Add support for NativeChurch theme
Expand Down
2 changes: 1 addition & 1 deletion sermons.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.9
* Version: 2.15.10
* Author: WP for Church
* Author URI: https://www.wpforchurch.com/
* Requires at least: 4.5
Expand Down
4 changes: 3 additions & 1 deletion views/single-wpfc_sermon.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
}

if ( comments_open() || get_comments_number() ) :
comments_template();
if ( ! apply_filters( 'single-wpfc_sermon-disable-comments', false ) ) {
comments_template();
}
endif;
endwhile;

Expand Down
7 changes: 7 additions & 0 deletions views/wpfc-podcast-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
'terms' => $term,
),
);

// Append term name to the feed title, so it looks like "Feed Name - Term Name".
$settings['title'] = single_term_title( $settings['title'] . ' - ', false );
}

/**
Expand All @@ -129,6 +132,10 @@
// Override the default tax_query for that taxonomy.
if ( ! empty( $args['tax_query'] ) ) {
foreach ( $args['tax_query'] as $id => $arg ) {
if ( ! is_array( $arg ) ) {
continue;
}

if ( $arg['taxonomy'] === $taxonomy ) {
unset( $args['tax_query'][ $id ] );
}
Expand Down

0 comments on commit a460565

Please sign in to comment.