Making WordPress.org


Ignore:
Timestamp:
11/23/2022 02:00:20 AM (2 years ago)
Author:
adamwood
Message:

Learn: Sync with git WordPress/learn@b09aca7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/archive-lesson-plan.php

    r12153 r12268  
    4343        <hr>
    4444        <?php
    45         $categories = get_terms( array(
    46             'taxonomy'   => 'wporg_lesson_category',
    47             'hide_empty' => false,
    48             'orderby'    => 'id',
    49             'order'      => 'DESC',
    50         ) );
    51         ?>
    52         <div class="lp-taxonomy">
    53             <h2 class="h4 lp-taxonomy-header"><?php echo esc_html__( 'Topic', 'wporg-learn' ); ?></h2>
    54             <div class="lp-taxonomy-description"><?php echo esc_html__( 'Browse lesson plans by their high-level topic.', 'wporg-learn' ); ?></div>
    55             <div class="card-grid card-grid_4">
    56                 <?php foreach ( $categories as $category ) :
    57                     $is_sticky = get_term_meta( $category->term_id, 'sticky', true );
    58                     if ( $is_sticky ) :
    59                         ?>
    60                     <a class="card button" href="<?php echo esc_url( get_term_link( $category ) ); ?>">
    61                         <?php $category_icon = get_term_meta( $category->term_id, 'dashicon-class', true ) ?? 'wordpress-alt'; ?>
    62                         <div>
    63                             <span aria-hidden="true" class="dashicons dashicons-<?php echo esc_attr( $category_icon ); ?>"></span>
    64                         </div>
    65                         <?php echo esc_html( $category->name ); ?>
    66                     </a>
    67                         <?php
    68                     endif;
    69                 endforeach; ?>
    70             </div>
    71         </div>
     45        $topics = wporg_learn_get_sticky_topics_with_selected_first();
     46        if ( ! empty( $topics ) ) {
     47            ?>
     48            <div class="lp-taxonomy">
     49                <h2 class="h4 lp-taxonomy-header"><?php echo esc_html__( 'Topic', 'wporg-learn' ); ?></h2>
     50                <div class="lp-taxonomy-description"><?php echo esc_html__( 'Browse lesson plans by their high-level topic.', 'wporg-learn' ); ?></div>
     51                <div class="card-grid card-grid_4">
     52                    <?php foreach ( $topics as $topic ) : ?>
     53                        <a class="card button topic-<?php echo esc_attr( $topic->term_id ); ?>" href="<?php echo esc_url( get_term_link( $topic ) ); ?>">
     54                            <?php $topic_icon = get_term_meta( $topic->term_id, 'dashicon-class', true ) ?? 'wordpress-alt'; ?>
     55                            <div>
     56                                <span aria-hidden="true" class="dashicons dashicons-<?php echo esc_attr( $topic_icon ); ?>"></span>
     57                            </div>
     58                            <?php echo esc_html( $topic->name ); ?>
     59                        </a>
     60                    <?php endforeach; ?>
     61                </div>
     62            </div>
     63            <?php
     64        } ?>
    7265
    7366        <?php
     
    152145                    endforeach;
    153146
    154                     if ( $any_duration_arr['duration'] ) :
     147                    if ( isset( $any_duration_arr['duration'] ) ) :
    155148                        ?>
    156149                        <li>
Note: See TracChangeset for help on using the changeset viewer.