Skip to content

Commit cdb3f4b

Browse files
authored
WordCamp Central: About page: Update the number of countries to be dynamic.
1 parent f609590 commit cdb3f4b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

public_html/wp-content/themes/wordcamp-central-2012/functions.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ protected static function get_map_stats() {
799799

800800
if ( ! $map_stats ) {
801801
$cities = array();
802+
$countries = array();
802803
$wordcamps = new WP_Query( array(
803804
'post_type' => 'wordcamp',
804805
'post_status' => WordCamp_Loader::get_public_post_statuses(),
@@ -815,6 +816,12 @@ protected static function get_map_stats() {
815816
$city = explode( '.', $hostname );
816817
$cities[ $city[0] ] = true;
817818
}
819+
820+
// Count the number of countries.
821+
$country = get_post_meta( $wordcamp->ID, '_venue_country_code', true );
822+
if ( $country ) {
823+
$countries[ $country ] = true;
824+
}
818825
}
819826

820827
// @todo generate countries automatically from _venue_country_code field, but need to populate older camps first.
@@ -823,8 +830,8 @@ protected static function get_map_stats() {
823830
$map_stats = array(
824831
'wordcamps' => $wordcamps->found_posts,
825832
'cities' => count( $cities ),
826-
'countries' => 65,
827-
'continents' => 6,
833+
'countries' => count( $countries ),
834+
'continents' => 6, // We're still waiting for WordCamp Antarctica.
828835
);
829836

830837
set_transient( $transient_key, $map_stats, 2 * WEEK_IN_SECONDS );

0 commit comments

Comments
 (0)