Changeset 2024621
- Timestamp:
- 02/04/2019 01:31:42 PM (7 years ago)
- Location:
- sermon-manager-for-wordpress/trunk
- Files:
-
- 2 edited
-
includes/class-sm-shortcodes.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sermon-manager-for-wordpress/trunk/includes/class-sm-shortcodes.php
r2022760 r2024621 561 561 562 562 // Get latest series. 563 $latest_series = $this->get_latest_series ( 0, $args['service_type'] );563 $latest_series = $this->get_latest_series_with_image( 0, $args['service_type'] ); 564 564 565 565 // If for some reason we couldn't get latest series. 566 566 if ( null === $latest_series ) { 567 567 return 'No latest series found.'; 568 } elseif ( false === $latest_series ) { 569 return 'No latest series image found.'; 568 570 } 569 571 … … 620 622 * @return WP_Term|null 621 623 */ 622 public function get_latest_series ( $latest_sermon = 0, $service_type = 0 ) {624 public function get_latest_series_with_image( $latest_sermon = 0, $service_type = 0 ) { 623 625 if ( empty( $latest_sermon ) ) { 624 626 $latest_sermon = $this->get_latest_sermon_id( $service_type ); … … 627 629 $latest_series = get_the_terms( $latest_sermon, 'wpfc_sermon_series' ); 628 630 629 if ( is_array( $latest_series ) && ! empty( $latest_series ) ) { 630 return $latest_series[0]; 631 } 632 633 return null; 631 foreach ( $latest_series as $series ) { 632 if ( $this->get_latest_series_image_id( $series ) ) { 633 return $series; 634 } 635 } 636 637 return is_array( $latest_series ) && count( $latest_series ) > 0 ? false : null; 634 638 } 635 639 … … 701 705 */ 702 706 function get_latest_series_image_id( $series = 0 ) { 703 if ( 0 === $series) {704 $series = $this->get_latest_series();705 706 if ( null === $series ) {707 return null;708 }707 if ( 0 !== $series && is_numeric( $series ) ) { 708 $series = intval( $series ); 709 } elseif ( $series instanceof WP_Term ) { 710 $series = $series->term_id; 711 } else { 712 return null; 709 713 } 710 714 711 715 $associations = sermon_image_plugin_get_associations(); 712 $tt_id = absint( $series ->term_taxonomy_id);716 $tt_id = absint( $series ); 713 717 714 718 if ( array_key_exists( $tt_id, $associations ) ) { -
sermon-manager-for-wordpress/trunk/readme.txt
r2021789 r2024621 124 124 ## Changelog ## 125 125 ### 2.15.14 ### 126 * Add compatibility for Pro theme 126 * Fix: Improve [latest_series] shortcode 127 * New: Add compatibility for Pro theme 127 128 128 129 ### 2.15.13 ###
Note: See TracChangeset
for help on using the changeset viewer.