WordPress.org

Making WordPress.org


Ignore:
Timestamp:
07/03/2019 10:39:41 AM (7 months ago)
Author:
tellyworth
Message:

Make/meetings: fix sorting of meetings times.

Was broken by r8952.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-meeting-posttype/wporg-meeting-posttype.php

    r8953 r9021  
    459459            array(
    460460                'post_type' => 'meeting',
    461                 'posts_per_page'  => $attr['limit'],
     461                'nopaging'  => true,
    462462                'meta_query' => array(
    463463                    'relation' => 'AND',
     
    472472        );
    473473
     474        $limit = $attr['limit'] > 0 ? $attr['limit'] : count( $query->posts );
     475
    474476        $out = '';
    475         foreach ( $query->posts as $post ) {
     477        foreach ( array_slice( $query->posts, 0, $limit ) as $post ) {
    476478            $next_meeting_datestring = $post->next_date;
    477479            $utc_time = strftime( '%H:%M:%S', strtotime( $post->time ) );
     
    488490            $out .= esc_html( $attr['before'] );
    489491            $out .= '<strong class="meeting-title">' . esc_html( $post->post_title ) . '</strong>';
    490             $display_count = $query->found_posts - count($query->posts);
    491             if ( $attr['more'] ) {
    492                 $out .= $display_count === 0 ? '' : ' <a title="Click to view all meetings for this team" href="/meetings#' . esc_attr( $attr['team'] ) . '">' . sprintf( __( '(+%s more)'), $display_count ) . '</a>';
     492            $display_more = $query->found_posts - intval( $limit );
     493            if ( $display_more > 0 ) {
     494                $out .= $display_count === 0 ? '' : ' <a title="Click to view all meetings for this team" href="/meetings#' . esc_attr( $attr['team'] ) . '">' . sprintf( __( '(+%s more)'), $display_more ) . '</a>';
    493495            }
    494496            $out .= '</br>';
Note: See TracChangeset for help on using the changeset viewer.