Making WordPress.org


Ignore:
Timestamp:
01/09/2015 01:47:26 AM (11 years ago)
Author:
iandunn
Message:

Central Theme: Group wordcamps on the Past WordCamps template by year.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012/functions.php

    r1106 r1113  
    607607        }
    608608    }
     609
     610    /**
     611     * Group an array of WordCamps by year
     612     *
     613     * @param array $wordcamps
     614     *
     615     * @return array
     616     */
     617    public static function group_wordcamps_by_year( $wordcamps ) {
     618        $grouped_wordcamps = array();
     619
     620        foreach ( $wordcamps as $wordcamp ) {
     621            if ( $year = date( 'Y', get_post_meta( $wordcamp->ID, 'Start Date (YYYY-mm-dd)', true ) ) ) {
     622                $grouped_wordcamps[ $year ][] = $wordcamp;
     623            }
     624        }
     625
     626        return $grouped_wordcamps;
     627    }
    609628}
    610629
Note: See TracChangeset for help on using the changeset viewer.