@@ -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.
0 commit comments