Plugin Directory

Changeset 2024621


Ignore:
Timestamp:
02/04/2019 01:31:42 PM (7 years ago)
Author:
nikolam
Message:

Merge remote-tracking branch 'origin\/dev' into dev

Location:
sermon-manager-for-wordpress/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sermon-manager-for-wordpress/trunk/includes/class-sm-shortcodes.php

    r2022760 r2024621  
    561561
    562562        // 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'] );
    564564
    565565        // If for some reason we couldn't get latest series.
    566566        if ( null === $latest_series ) {
    567567            return 'No latest series found.';
     568        } elseif ( false === $latest_series ) {
     569            return 'No latest series image found.';
    568570        }
    569571
     
    620622     * @return WP_Term|null
    621623     */
    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 ) {
    623625        if ( empty( $latest_sermon ) ) {
    624626            $latest_sermon = $this->get_latest_sermon_id( $service_type );
     
    627629        $latest_series = get_the_terms( $latest_sermon, 'wpfc_sermon_series' );
    628630
    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;
    634638    }
    635639
     
    701705     */
    702706    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;
    709713        }
    710714
    711715        $associations = sermon_image_plugin_get_associations();
    712         $tt_id        = absint( $series->term_taxonomy_id );
     716        $tt_id        = absint( $series );
    713717
    714718        if ( array_key_exists( $tt_id, $associations ) ) {
  • sermon-manager-for-wordpress/trunk/readme.txt

    r2021789 r2024621  
    124124## Changelog ##
    125125### 2.15.14 ###
    126 * Add compatibility for Pro theme
     126* Fix: Improve [latest_series] shortcode
     127* New: Add compatibility for Pro theme
    127128
    128129### 2.15.13 ###
Note: See TracChangeset for help on using the changeset viewer.