public function post_color_info() { $this->post_color_info = array(); $this->total_terms = 0; //----- LOOP THROUGH RELATED PROGRAMS -----// $related_programs = wp_get_post_terms($this->post_id, 'program_taxo'); foreach ($related_programs as $program) { $program = get_page_by_path($program->slug, OBJECT, 'program'); //----- GET COLOR DATA BASED ON PROGRAMS CLASSIFICATION -----// $program_class = get_program_class($program->ID); foreach ($program_class as $classification) { $class_slug = $classification->slug; if (array_key_exists($classification->slug, $this->post_color_info)) { $this->post_color_info[$class_slug]['count'] = ++$this->post_color_info[$class_slug]['count']; } else { $this->post_color_info[$class_slug] = array('slug' => $class_slug, 'count' => 1, 'color' => get_program_color($program->ID)); } //----- UPDATE TOTAL TERMS EVERYTIME TERM IN FOUND -----// $this->total_terms = ++$this->total_terms; } } usort($this->post_color_info, array($this, 'sort_by_count')); }
<?php /** * Upcoming Schools Section * * This section displays a list of the six most * upcoming schools. */ front_page_hr('Upcoming Schools'); $upcoming_schools = get_upcoming_schools(6); echo '<div class="row"><div class="small-12 columns">'; echo '<ul class="row small-block-grid-2 medium-block-grid 3 large-block-grid-6 front-page-upcoming-schools-container">'; foreach ($upcoming_schools->schools as $upcoming_school) { echo '<li>'; echo '<a href="' . get_permalink($upcoming_school['program_id']) . '">'; $program_color = get_program_color($upcoming_school['program_id']); $thumbnail_args = array('style' => "border: 3px solid {$program_color}"); echo get_the_post_thumbnail($upcoming_school['program_id'], 'thumbnail', $thumbnail_args); echo '<div class="upcoming-school-title">' . $upcoming_school['program_name'] . '</div>'; echo '</a>'; echo '</li>'; } echo '</ul></div>'; echo '</div>'; ?> <?php /** * Call To Action Section * * This section is used to call a specific