Making WordPress.org


Ignore:
Timestamp:
08/25/2020 12:15:55 AM (6 years ago)
Author:
dufresnesteven
Message:

WordPress.org Learn: Sync with GitHub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/template-parts/component-featured-workshop.php

    r10169 r10202  
    88 */
    99
    10 $featured_workshop = wporg_get_workshops( array( 'posts_per_page' => 1 ) );
     10$featured_workshop = wporg_get_featured_workshops();
     11$featured_workshop = reset( $featured_workshop );
    1112?>
    1213
    13 <div class="featured-workshop">
    14     <?php while ( $featured_workshop->have_posts() ) :
    15         $featured_workshop->the_post(); ?>
    16         <div class="featured-workshop_video">
    17             <?php
    18             // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    19             echo wporg_get_post_thumbnail( $post, 'full' );
    20             ?>
    21         </div>
    22         <div class="featured-workshop_content">
    23             <a class="featured-workshop_title" href="<?php echo esc_url( get_the_permalink() ); ?>"><?php the_title(); ?></a>
    24             <div class="row">
    25                 <div class="col-8">
    26                     <p><?php the_excerpt(); ?></p>
    27                 </div>
    28                 <div class="col-4 featured-workshop_content_author">
    29                     <?php
    30                     $presenters = wporg_get_workshop_presenters();
    31 
     14<?php if ( $featured_workshop ) : ?>
     15    <div class="featured-workshop">
     16        <?php
     17        $post = $featured_workshop; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
     18        setup_postdata( $post );
     19        ?>
     20            <div class="featured-workshop_video">
     21                <?php
     22                // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     23                echo wporg_get_post_thumbnail( $post, 'full' );
     24                ?>
     25            </div>
     26            <div class="featured-workshop_content">
     27                <a class="featured-workshop_title" href="<?php echo esc_url( get_the_permalink() ); ?>"><?php the_title(); ?></a>
     28                <div class="row">
     29                    <div class="col-8">
     30                        <p><?php the_excerpt(); ?></p>
     31                    </div>
     32                    <div class="col-4 featured-workshop_content_author">
     33                        <?php
     34                        $presenters = wporg_get_workshop_presenters();
    3235                        // We'll only display the first author in this view
    33                     if ( isset( $presenters[0] ) ) :
    34                         get_template_part( 'template-parts/component', 'workshop-presenter',
    35                             array(
    36                                 'presenter' => $presenters[0],
    37                                 'class' => 'workshop-presenter--is-centered',
    38                             )
    39                         );
     36                        if ( isset( $presenters[0] ) ) :
     37                            get_template_part( 'template-parts/component', 'workshop-presenter',
     38                                array(
     39                                    'presenter' => $presenters[0],
     40                                    'class' => 'workshop-presenter--is-centered',
     41                                )
     42                            );
    4043                        endif;
    41                     ?>
     44                        ?>
     45                    </div>
    4246                </div>
    4347            </div>
    44         </div>
    45         <?php
    46         endwhile;
    47         wp_reset_postdata();
    48     ?>
    49 </div>
     48        <?php wp_reset_postdata(); ?>
     49    </div>
     50<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.