Making WordPress.org

Ticket #2065: 2065.2.patch

File 2065.2.patch, 3.6 KB (added by frq, 7 years ago)
  • themes/wordcamp-central-2012/functions.php

     
    714714                return $query;
    715715        }
    716716
    717         public static function the_wordcamp_date( $wordcamp_id = 0 ) {
     717        public static function the_wordcamp_date( $wordcamp_id = 0, $show_year = false ) {
    718718                $start_day = wcpt_get_wordcamp_start_date( $wordcamp_id, 'j' );
    719719                $start_month = wcpt_get_wordcamp_start_date( $wordcamp_id, 'F' );
    720720                $end_day = wcpt_get_wordcamp_end_date( $wordcamp_id, 'j' );
    721721                $end_month = wcpt_get_wordcamp_end_date( $wordcamp_id, 'F' );
    722722
     723                if ( $show_year ){
     724                        $start_year = wcpt_get_wordcamp_start_date( $wordcamp_id, 'Y' );
     725                        $end_year = wcpt_get_wordcamp_end_date( $wordcamp_id, 'Y' );
     726                }
     727
    723728                echo "$start_month $start_day";
    724729                if ( $end_day ) {
     730                        if ( $show_year && $start_year != $end_year )
     731                                echo ", $start_year";
    725732                        echo '-';
     733
    726734                        if ( $start_month != $end_month )
    727735                                echo "$end_month ";
    728736
    729737                        echo $end_day;
    730                 }
     738
     739                        if ( $show_year )
     740                                echo ', $end_year';
     741                } // $end_day
    731742        }
    732743
    733744        /**
  • themes/wordcamp-central-2012/template-schedule.php

     
    3737                                                        ) )
    3838                                                ) )
    3939                                        ) :
     40                                                global $wcpt_template;
     41                                                $wordcamps = WordCamp_Central_Theme::group_wordcamps_by_year( $wcpt_template->posts );
    4042                                        ?>
     43                                        <?php foreach ( $wordcamps as $year => $posts ) : ?>
     44                                                <h3 class="wc-schedule-year"><?php echo esc_html( $year ); ?></h3>
    4145
    42                                         <ul class="wc-schedule-list">
    43                                         <?php while ( wcpt_wordcamps() ) : wcpt_the_wordcamp(); ?>
     46                                                <ul class="wc-schedule-list">
     47                                                        <?php foreach ( $posts as $post ) :     setup_postdata( $post ); ?>
    4448
    45                                                 <li>
    46                                                         <a href="<?php echo esc_url( wcpt_get_wordcamp_url() ); ?>">
    47                                                                 <?php if ( has_post_thumbnail() ) : ?>
    48                                                                         <?php the_post_thumbnail( 'wccentral-thumbnail-small', array( 'class' => 'wc-image' ) ); ?>
    49                                                                 <?php else : ?>
    50                                                                         <div class="wc-image wp-post-image wordcamp-placeholder-thumb" title="<?php the_title(); ?>"></div>
    51                                                                 <?php endif; ?>
     49                                                        <li>
     50                                                                <a href="<?php echo esc_url( wcpt_get_wordcamp_url() ); ?>">
     51                                                                        <?php if ( has_post_thumbnail() ) : ?>
     52                                                                                <?php the_post_thumbnail( 'wccentral-thumbnail-small', array( 'class' => 'wc-image' ) ); ?>
     53                                                                        <?php else : ?>
     54                                                                                <div class="wc-image wp-post-image wordcamp-placeholder-thumb" title="<?php the_title(); ?>"></div>
     55                                                                        <?php endif; ?>
    5256
    53                                                                 <h2 class="wc-title"><?php wcpt_wordcamp_title(); ?></h2>
    54                                                                 <span class="wc-country"><?php wcpt_wordcamp_location(); ?></span>
    55                                                                 <span class="wc-date">
    56                                                                         <?php WordCamp_Central_Theme::the_wordcamp_date(); ?>
    57                                                                 </span>
    58                                                         </a>
    59                                                 </li>
     57                                                                        <h2 class="wc-title"><?php wcpt_wordcamp_title(); ?></h2>
     58                                                                        <span class="wc-country"><?php wcpt_wordcamp_location(); ?></span>
     59                                                                        <span class="wc-date">
     60                                                                                <?php WordCamp_Central_Theme::the_wordcamp_date(); ?>
     61                                                                        </span>
     62                                                                </a>
     63                                                        </li>
    6064
    61                                         <?php endwhile; // wcpt_wordcamps ?>
    62                                 </ul>
     65                                                        <?php endforeach; // $posts as post ?>
     66                                                </ul>
     67                                        <?php wp_reset_postdata(); endforeach; ?>
     68
    6369                                <a href="<?php echo home_url( '/schedule/past-wordcamps/' ); ?>" class="wc-schedule-more">Past WordCamps &rarr;</a>
    6470
    6571                                <?php endif; // wcpt_has_wordcamps ?>