context['postId'] ) ? $block->context['postId'] : get_the_ID() ); if ( ! $academy_course ) { return; } if ( empty( $academy_course['is_sticky'] ) ) { // In the Customize preview, a site with no featured course would show no // badge whichever way the switch is set, so the first card gets one as a // sample. if ( ! empty( $GLOBALS['academy_course_badge_sample_shown'] ) || ! \Academy\Design\Preview::is_preview() || get_posts( [ 'post_type' => 'academy_courses', 'post_status' => 'publish', 'posts_per_page' => 1, 'fields' => 'ids', 'meta_key' => \Academy\Helper::STICKY_META_KEY, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- preview only. 'meta_value' => '1', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value -- preview only. ] ) ) { return; } $GLOBALS['academy_course_badge_sample_shown'] = true; }//end if ?> >