Making WordPress.org

Changeset 4461


Ignore:
Timestamp:
12/03/2016 03:52:11 PM (8 years ago)
Author:
coreymckrill
Message:

Handle WordCamps with no end date in wcord_get_wordcamp_duration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/helper-functions.php

    r4459 r4461  
    269269 */
    270270function wcord_get_wordcamp_duration( WP_Post $wordcamp ) {
     271    // @todo Make sure $wordcamp is the correct post type
     272
    271273    $start = get_post_meta( $wordcamp->ID, 'Start Date (YYYY-mm-dd)', true );
    272274    $end   = get_post_meta( $wordcamp->ID, 'End Date (YYYY-mm-dd)', true );
    273275
     276    // Assume 1 day duration if there is no end date
     277    if ( ! $end ) {
     278        return 1;
     279    }
     280
    274281    $duration_raw = $end - $start;
    275282
Note: See TracChangeset for help on using the changeset viewer.