Changeset 12096 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/archive-course.php
- Timestamp:
- 09/28/2022 11:18:13 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/archive-course.php
r11697 r12096 21 21 22 22 <section> 23 <div class="row align-middle between section-heading section-heading--with-space ">24 <?php the_archive_title( '<h1 class="section-heading_title h2 ">', '</h1>' ); ?>23 <div class="row align-middle between section-heading section-heading--with-space gutters"> 24 <?php the_archive_title( '<h1 class="section-heading_title h2 col-8">', '</h1>' ); ?> 25 25 <?php get_template_part( 'template-parts/component', 'archive-search' ); ?> 26 26 </div> … … 28 28 <hr> 29 29 30 <div class="card-grid card-grid_2">31 30 <?php if ( have_posts() ) : ?> 32 31 <?php while ( have_posts() ) : 33 32 the_post(); 34 33 35 $display_category_header = false; 36 $categories = get_the_terms( get_the_ID(), 'course-category' ); 34 $prev_category; 35 $begin_new_category = false; 36 $categories = get_the_terms( get_the_ID(), 'course-category' ); 37 37 38 if ( isset( $categories[0] ) ) { 38 $category_title = $categories[0]->name;39 $category_title = $categories[0]->name; 39 40 $category_description = $categories[0]->description; 40 if ( $category_title != $prev_category ) { 41 $display_category_header = true; 42 $prev_category = $category_title; 43 } 41 $begin_new_category = $category_title !== $prev_category; 44 42 } 45 43 46 if ( $display_category_header ) { 47 echo '<h2 class="h4 course-category-header">' . esc_html( $category_title ) . '</h2>'; 44 if ( $begin_new_category ) { 45 // Close the previous card-grid if there was a previous category 46 if ( ! empty( $prev_category ) ) { 47 echo '</div>'; 48 } 49 ?> 50 <h2 class="h4 course-category-header"><?php echo esc_html( $category_title ); ?></h2> 51 <?php 48 52 if ( $category_description ) { 49 53 echo '<div class="course-category-description">' . esc_html( $category_description ) . '</div>'; 50 54 } 55 ?> 56 <div class="card-grid card-grid_2"> 57 <?php 58 $prev_category = $category_title; 51 59 } 52 60 … … 57 65 ); 58 66 endwhile; ?> 67 </div> 59 68 <?php else : ?> 60 69 <?php get_template_part( 'template-parts/content', 'none' ); ?> 61 70 <?php endif; ?> 62 </div>63 71 64 72 <?php the_posts_pagination(); ?>
Note: See TracChangeset
for help on using the changeset viewer.