Making WordPress.org

Changeset 11323


Ignore:
Timestamp:
11/11/2021 03:53:36 AM (5 years ago)
Author:
tellyworth
Message:

WordPress.org Learn: Sync with GitHub

Props hlashbrooke, ronalfy.

https://github.com/WordPress/learn/compare/b0cc237f6c2787a04f305bfdd28e0bca92b9415a...376c877bea94e328f57a2c288bc4abc7d9ba43d4

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020
Files:
4 edited

Legend:

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

    r11279 r11323  
    276276                        array(
    277277                                'post_date' => 'DESC',
    278                                 'ID' => 'ASC',
     278                                'ID'        => 'ASC',
    279279                        )
    280280                );
     
    360360                 * grouping, there would be a separate row for each postmeta value for each workshop post.
    361361                 */
    362                 $clauses['fields']  .= ",
     362                $clauses['fields'] .= ",
    363363                        MAX( IF( pmeta.meta_key = 'video_language' AND pmeta.meta_value LIKE '{$locale_root}%', 1, 0 ) ) AS has_language
    364364                ";
    365                 $clauses['fields']  .= ",
     365                $clauses['fields'] .= ",
    366366                        MAX( IF( pmeta.meta_key = 'video_caption_language' AND pmeta.meta_value LIKE '{$locale_root}%', 1, 0 ) ) AS has_caption
    367367                ";
    368                 $clauses['join']    .= " INNER JOIN {$wpdb->postmeta} pmeta ON ( {$wpdb->posts}.ID = pmeta.post_id )";
     368                $clauses['join']   .= " INNER JOIN {$wpdb->postmeta} pmeta ON ( {$wpdb->posts}.ID = pmeta.post_id )";
    369369                // This orderby clause ensures that the workshops are sorted by the values in the calculated columns first.
    370370                $clauses['orderby'] = 'has_language DESC, has_caption DESC, ' . $clauses['orderby'];
     
    432432        $meta_query = array();
    433433        $tax_query = array();
     434
    434435        $is_filtered = false;
    435436
     
    512513 */
    513514function wporg_get_archive_query( $post_type, array $args = array() ) {
    514         $args = wp_parse_args( $args, array(
    515                 'post_type'   => $post_type,
    516                 'post_status' => 'publish',
    517         ) );
     515        $args = wp_parse_args(
     516                $args,
     517                array(
     518                        'post_type'   => $post_type,
     519                        'post_status' => 'publish',
     520                )
     521        );
    518522
    519523        return new WP_Query( $args );
     
    528532 */
    529533function wporg_learn_get_card_template_args( $post_id ) {
    530         $post = get_post( $post_id );
     534        $post      = get_post( $post_id );
    531535        $post_type = get_post_type( $post );
    532536
     
    549553
    550554                        if ( is_user_logged_in() ) {
    551                                 $completed    = count( Sensei()->course->get_completed_lesson_ids( $post_id, get_current_user_id() ) );
     555                                $completed = count( Sensei()->course->get_completed_lesson_ids( $post_id, get_current_user_id() ) );
    552556
    553557                                $args['meta'][] = array(
     
    924928
    925929/**
     930 * Register theme sidebars.
     931 */
     932function wporg_learn_register_sidebars() {
     933        // Register lesson plans sidebar.
     934        register_sidebar(
     935                array(
     936                        'name'          => __( 'Lesson Plans', 'wporg-learn' ),
     937                        'id'            => 'wporg-learn-lesson-plans',
     938                        'before_widget' => '<div id="%1$s" class="block-widgets %2$s">',
     939                        'after_widget'  => '</div>',
     940                        'before_title'  => '<h4 class="widget-title">',
     941                        'after_title'   => '<h4>',
     942                )
     943        );
     944
     945        // Register courses sidebar.
     946        register_sidebar(
     947                array(
     948                        'name'          => __( 'Courses', 'wporg-learn' ),
     949                        'id'            => 'wporg-learn-courses',
     950                        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
     951                        'after_widget'  => '</aside>',
     952                        'before_title'  => '<h4 class="widget-title">',
     953                        'after_title'   => '</h4>',
     954                )
     955        );
     956
     957        // Register workshops sidebar.
     958        register_sidebar(
     959                array(
     960                        'name'          => __( 'Workshops', 'wporg-learn' ),
     961                        'id'            => 'wporg-learn-workshops',
     962                        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
     963                        'after_widget'  => '</aside>',
     964                        'before_title'  => '<h4 class="widget-title">',
     965                        'after_title'   => '</h4>',
     966                )
     967        );
     968}
     969add_filter( 'widgets_init', 'wporg_learn_register_sidebars', 10 );
     970
     971/**
    926972 * Add fallback image to Jetpack when no featured image exists.
    927973 *
     
    934980}
    935981add_action( 'jetpack_open_graph_image_default', 'wporg_learn_return_default_image', 15, 1 );
     982
     983/**
     984 * Disable the News XML Sitemap generated by Jetpack
     985 */
     986add_filter( 'jetpack_news_sitemap_generate', '__return_false' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/single-lesson-plan.php

    r10169 r11323  
    1717                                the_post();
    1818
    19                                 get_template_part( 'template-parts/content', 'single' );
     19                                get_template_part( 'template-parts/content', 'single', array( 'context' => 'lesson-plan' ) );
    2020                        endwhile; // End of the loop.
    2121                        ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/template-parts/content-single.php

    r11300 r11323  
    2929                                ?>
    3030                        </div>
    31                         <aside class="lp-sidebar">
    32                                 <div class="lp-details">
    33                                         <ul>
    34                                                 <?php
    35                                                 foreach ( wporg_learn_get_lesson_plan_taxonomy_data( get_the_ID() ) as $detail ) {
    36                                                         if ( ! empty( $detail['value'] ) ) {
    37                                                                 include locate_template( 'template-parts/component-taxonomy-item.php' );
    38                                                         }
    39                                                 }
    40                                                 ?>
    41                                         </ul>
    4231
    43                                         <ul class="lp-links">
    44                                                 <?php if ( $post->slides_view_url ) : ?>
    45                                                         <li>
    46                                                                 <a href="<?php echo esc_attr( $post->slides_view_url ); ?>" target="_blank">
    47                                                                         <span class="dashicons dashicons-admin-page"></span>
    48                                                                         <?php esc_html_e( 'View Lesson Plan Slides', 'wporg-learn' ); ?>
    49                                                                 </a>
    50                                                         </li>
    51                                                 <?php endif; ?>
    52                                                 <?php if ( $post->slides_download_url ) : ?>
    53                                                         <li>
    54                                                                 <a href="<?php echo esc_attr( $post->slides_download_url ); ?>">
    55                                                                         <span class="dashicons dashicons-download"></span>
    56                                                                         <?php esc_html_e( 'Download Lesson Slides', 'wporg-learn' ); ?>
    57                                                                 </a>
    58                                                         </li>
    59                                                 <?php endif; ?>
    60                                                 <!-- <li>
    61                                                         <a href="#" target="_blank">
    62                                                                 <span class="dashicons dashicons-admin-post"></span>
    63                                                                 <?php esc_html_e( 'Print Lesson Plan', 'wporg-learn' ); ?>
    64                                                         </a>
    65                                                 </li> -->
    66                                         </ul>
    67                                         <div class="lp-print">
    68                                                 <p><a href="#" onclick="window.print();"><?php esc_html_e( 'Print view', 'wporg-learn' ); ?></a></p>
    69                                         </div>
    70                                         <div class="lp-suggestion">
    71                                                 <h2 class="lp-suggestion_title h4"><?php esc_html_e( 'Suggestions', 'wporg-learn' ); ?></h2>
    72                                                 <p><?php esc_html_e( 'Found a typo, grammar error,or outdated screenshot?', 'wporg-learn' ); ?></p>
    73                                                 <p><?php esc_html_e( 'Used this lesson plan in your event and have some suggestions?', 'wporg-learn' ); ?></p>
    74                                                 <a href="https://learn.wordpress.org/report-content-errors/"><?php esc_html_e( 'Let us know!', 'wporg-learn' ); ?></a>
    75                                         </div>
    76                                 </div>
    77                         </aside>
     32                        <?php
     33                        /**
     34                         * Read in passed context and render sidebar.
     35                         */
     36                        switch ( get_post_type() ) {
     37                                case 'lesson-plan':
     38                                        get_sidebar( 'lesson-plan' );
     39                                        break;
     40                                case 'course':
     41                                        get_sidebar( 'course' );
     42                                        break;
     43                        }
     44                        ?>
    7845                </div>
    7946        </section>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/template-parts/content-workshop-single.php

    r11300 r11323  
    5050                                        </div>
    5151
    52                                         <div class="wp-block-button is-style-secondary-full-width">
    53                                                 <a
    54                                                         class="wp-block-button__link"
    55                                                         href="https://learn.wordpress.org/social-learning/"
    56                                                         style="border-radius:5px"
    57                                                 >
    58                                                         <?php esc_html_e( 'Join a Social Learning Space', 'wporg-learn' ); ?>
    59                                                 </a>
    60                                         </div>
    61 
    62                                         <p class="terms">
    63                                                 <?php printf(
    64                                                         wp_kses_data( __( 'You must agree to our <a href="%s">Code of Conduct</a> in order to participate.', 'wporg-learn' ) ),
    65                                                         esc_url( get_permalink( get_page_by_path( 'code-of-conduct' ) ) )
    66                                                 ); ?>
    67                                         </p>
     52                                        <?php get_sidebar( 'workshop' ); ?>
    6853
    6954                                </div> <!-- end sidebar column -->
Note: See TracChangeset for help on using the changeset viewer.