Support » Plugin: Sermon Manager » Filtering bug fix

  • In /sermons.php,
    line 250: public static function fix_sermons_ordering( $query )

    public static function fix_sermons_ordering( $query ) {
    		if ( ! is_admin() && ( $query->is_main_query() ) ) {
    			if ( is_post_type_archive( 'wpfc_sermon' ) || is_tax( sm_get_taxonomies() ) ) {
    				$orderby = SermonManager::getOption( 'archive_orderby' );
    				$order   = SermonManager::getOption( 'archive_order' );
    
    				switch ( $orderby ) {
    					case 'date_preached':
    						$query->set( 'meta_key', 'sermon_date' );
    						$query->set( 'meta_value_num', time() );
    						$query->set( 'meta_compare', '<=' );
    						$query->set( 'orderby', 'meta_value_num' );
    						break;
    					case 'date_published':
    						$query->set( 'orderby', 'date' );
    						break;
    					case 'title':
    					case 'random':
    					case 'id':

    Case “id” needs to be “ID” or wrap $orderby in a strtolower()…

    Without this change, the option to sort by ID in the admin settings will not work.

  • The topic ‘Filtering bug fix’ is closed to new replies.