<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[13662] sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024: Learn: Sync with git WordPress/learn@f141b06</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/13662">13662</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/13662","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>adamwood</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-05-06 03:38:13 +0000 (Mon, 06 May 2024)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Learn: Sync with git WordPress/learn@f141b06</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2024functionsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2024stylecss">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/style.css</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/</li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2024incadminphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/admin.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2024inccapabilitiesphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/capabilities.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2024inctaxonomyphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/taxonomy.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2024functionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php 2024-05-03 03:39:01 UTC (rev 13661)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php 2024-05-06 03:38:13 UTC (rev 13662)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,6 +3,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\Theme\Learn_2024;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Admin.
+ */
+require __DIR__ . '/inc/admin.php';
+
+/**
+ * Capabilities.
+ */
+require __DIR__ . '/inc/capabilities.php';
+
+/**
+ * Taxonomies.
+ */
+require __DIR__ . '/inc/taxonomy.php';
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Actions and filters.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_assets' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -21,6 +36,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> array( 'wporg-parent-2021-style', 'wporg-global-fonts' ),
</span><span class="cx" style="display: block; padding: 0 10px"> filemtime( __DIR__ . '/build/style/style-index.css' )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Preload the heading font(s).
+ if ( is_callable( 'global_fonts_preload' ) ) {
+ /* translators: Subsets can be any of cyrillic, cyrillic-ext, greek, greek-ext, vietnamese, latin, latin-ext. */
+ $subsets = _x( 'Latin', 'Heading font subsets, comma separated', 'wporg-learn' );
+ // All headings.
+ global_fonts_preload( 'EB Garamond, Inter', $subsets );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,19 +54,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'learn' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'User', 'wporg-learn' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'url' => '/learning-pathways/user/',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'url' => '/learning-pathways/user/',
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Designer', 'wporg-learn' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'url' => '/learning-pathways/designer/',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'url' => '/learning-pathways/designer/',
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Contributor', 'wporg-learn' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'url' => '/learning-pathways/contributor/',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'url' => '/learning-pathways/contributor/',
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Developer', 'wporg-learn' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'url' => '/learning-pathways/developer/',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'url' => '/learning-pathways/developer/',
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2024incadminphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/admin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/admin.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/admin.php 2024-05-06 03:38:13 UTC (rev 13662)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,59 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace WordPressdotorg\Theme\Learn_2024\Admin;
+
+use WP_Query;
+use function WordPressdotorg\Theme\Learn_2024\Taxonomy\get_available_taxonomy_terms;
+
+defined( 'WPINC' ) || die();
+
+/**
+ * Actions and filters.
+ */
+add_action( 'restrict_manage_posts', __NAMESPACE__ . '\add_admin_list_table_filters', 10, 2 );
+
+/**
+ * Add filtering controls for the course and lesson list tables.
+ *
+ * @param string $post_type
+ * @param string $which
+ *
+ * @return void
+ */
+function add_admin_list_table_filters( $post_type, $which ) {
+ if ( ( 'course' !== $post_type && 'lesson' !== $post_type ) || 'top' !== $which ) {
+ return;
+ }
+
+ $audience = filter_input( INPUT_GET, 'wporg_audience', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
+ $level = filter_input( INPUT_GET, 'wporg_experience_level', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
+ $available_audiences = get_available_taxonomy_terms( 'audience', $post_type );
+ $available_levels = get_available_taxonomy_terms( 'level', $post_type );
+ ?>
+
+ <label for="filter-by-audience" class="screen-reader-text">
+ <?php esc_html_e( 'Filter by audience', 'wporg-learn' ); ?>
+ </label>
+ <select id="filter-by-audience" name="wporg_audience">
+ <option value=""<?php selected( ! $audience ); ?>><?php esc_html_e( 'Any audience', 'wporg-learn' ); ?></option>
+ <?php foreach ( $available_audiences as $code => $name ) : ?>
+ <option value="<?php echo esc_attr( $code ); ?>"<?php selected( $code, $audience ); ?>>
+ <?php echo esc_html( $name ); ?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+
+ <label for="filter-by-level" class="screen-reader-text">
+ <?php esc_html_e( 'Filter by level', 'wporg-learn' ); ?>
+ </label>
+ <select id="filter-by-level" name="wporg_experience_level">
+ <option value=""<?php selected( ! $level ); ?>><?php esc_html_e( 'Any level', 'wporg-learn' ); ?></option>
+ <?php foreach ( $available_levels as $code => $name ) : ?>
+ <option value="<?php echo esc_attr( $code ); ?>"<?php selected( $code, $level ); ?>>
+ <?php echo esc_html( $name ); ?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+
+ <?php
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/admin.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2024inccapabilitiesphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/capabilities.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/capabilities.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/capabilities.php 2024-05-06 03:38:13 UTC (rev 13662)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,42 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace WordPressdotorg\Theme\Learn_2024\Capabilities;
+
+defined( 'WPINC' ) || die();
+
+/**
+ * Actions and filters.
+ */
+add_filter( 'map_meta_cap', __NAMESPACE__ . '\map_meta_caps', 20, 4 ); // Needs to fire after meta caps in wporg-internal-notes.
+
+/**
+ * Map primitive caps to our custom caps.
+ *
+ * @param array $required_caps
+ * @param string $current_cap
+ * @param int $user_id
+ * @param mixed $args
+ *
+ * @return mixed
+ */
+function map_meta_caps( $required_caps, $current_cap, $user_id, $args ) {
+ switch ( $current_cap ) {
+ case 'edit_any_learn_content':
+ $required_caps = array();
+ $learn_content_types = array( 'course', 'lesson', 'meeting' );
+
+ // Grant `edit_any_learn_content` when the user has `edit_posts` for any of the learn post types.
+ foreach ( $learn_content_types as $post_type ) {
+ $object = get_post_type_object( $post_type );
+ if ( user_can( $user_id, $object->cap->edit_posts ) ) {
+ $required_caps[] = $object->cap->edit_posts;
+ break 2; // Breaks out of the foreach and the switch.
+ }
+ }
+
+ $required_caps[] = 'do_not_allow';
+ break;
+ }
+
+ return $required_caps;
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/capabilities.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2024inctaxonomyphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/taxonomy.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/taxonomy.php 2024-05-06 03:38:13 UTC (rev 13662)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,156 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace WordPressdotorg\Theme\Learn_2024\Taxonomy;
+
+defined( 'WPINC' ) || die();
+
+/**
+ * Actions and filters.
+ */
+add_action( 'init', __NAMESPACE__ . '\register' );
+
+/**
+ * Register all the taxonomies.
+ */
+function register() {
+ register_audience();
+ register_experience_level();
+}
+
+/**
+ * Register the Audience taxonomy.
+ */
+function register_audience() {
+ $labels = array(
+ 'name' => _x( 'Audiences', 'Taxonomy General Name', 'wporg-learn' ),
+ 'singular_name' => _x( 'Audience', 'Taxonomy Singular Name', 'wporg-learn' ),
+ 'menu_name' => __( 'Audience', 'wporg-learn' ),
+ 'all_items' => __( 'All audiences', 'wporg-learn' ),
+ 'parent_item' => __( 'Parent audience', 'wporg-learn' ),
+ 'parent_item_colon' => __( 'Parent audience:', 'wporg-learn' ),
+ 'new_item_name' => __( 'New audience Name', 'wporg-learn' ),
+ 'add_new_item' => __( 'Add New audience', 'wporg-learn' ),
+ 'edit_item' => __( 'Edit audience', 'wporg-learn' ),
+ 'update_item' => __( 'Update audience', 'wporg-learn' ),
+ 'view_item' => __( 'View audience', 'wporg-learn' ),
+ 'separate_items_with_commas' => __( 'Separate audiences with commas', 'wporg-learn' ),
+ 'add_or_remove_items' => __( 'Add or remove audiences', 'wporg-learn' ),
+ 'choose_from_most_used' => __( 'Choose from the most used', 'wporg-learn' ),
+ 'popular_items' => __( 'Popular audiences', 'wporg-learn' ),
+ 'search_items' => __( 'Search audiences', 'wporg-learn' ),
+ 'not_found' => __( 'No audience found', 'wporg-learn' ),
+ 'no_terms' => __( 'No audiences', 'wporg-learn' ),
+ 'items_list' => __( 'Audiences list', 'wporg-learn' ),
+ 'items_list_navigation' => __( 'Audiences list navigation', 'wporg-learn' ),
+ );
+
+ $args = array(
+ 'labels' => $labels,
+ 'hierarchical' => false,
+ 'public' => true,
+ 'query_var' => 'wporg_audience', // Prevent collisions with query params in the archive
+ 'show_ui' => true,
+ 'show_admin_column' => true,
+ 'show_in_nav_menus' => true,
+ 'show_tagcloud' => false,
+ 'show_in_rest' => true,
+ 'capabilities' => array(
+ 'assign_terms' => 'edit_any_learn_content', // See WordPressdotorg\Theme\Learn_2024\Capabilities\map_meta_caps
+ ),
+ );
+
+ register_taxonomy( 'audience', array( 'lesson', 'course' ), $args );
+}
+
+/**
+ * Register the Experience Level taxonomy.
+ */
+function register_experience_level() {
+ $labels = array(
+ 'name' => _x( 'Experience Levels', 'Taxonomy General Name', 'wporg-learn' ),
+ 'singular_name' => _x( 'Experience Level', 'Taxonomy Singular Name', 'wporg-learn' ),
+ 'menu_name' => __( 'Experience level', 'wporg-learn' ),
+ 'all_items' => __( 'All experience levels', 'wporg-learn' ),
+ 'parent_item' => __( 'Parent experience level', 'wporg-learn' ),
+ 'parent_item_colon' => __( 'Parent experience level:', 'wporg-learn' ),
+ 'new_item_name' => __( 'New experience level Name', 'wporg-learn' ),
+ 'add_new_item' => __( 'Add New experience level', 'wporg-learn' ),
+ 'edit_item' => __( 'Edit experience level', 'wporg-learn' ),
+ 'update_item' => __( 'Update experience level', 'wporg-learn' ),
+ 'view_item' => __( 'View experience level', 'wporg-learn' ),
+ 'separate_items_with_commas' => __( 'Separate experience levels with commas', 'wporg-learn' ),
+ 'add_or_remove_items' => __( 'Add or remove experience levels', 'wporg-learn' ),
+ 'choose_from_most_used' => __( 'Choose from the most used', 'wporg-learn' ),
+ 'popular_items' => __( 'Popular experience levels', 'wporg-learn' ),
+ 'search_items' => __( 'Search experience levels', 'wporg-learn' ),
+ 'not_found' => __( 'No experience level found', 'wporg-learn' ),
+ 'no_terms' => __( 'No experience levels', 'wporg-learn' ),
+ 'items_list' => __( 'Experience levels list', 'wporg-learn' ),
+ 'items_list_navigation' => __( 'Experience levels list navigation', 'wporg-learn' ),
+ );
+
+ $args = array(
+ 'labels' => $labels,
+ 'hierarchical' => false,
+ 'public' => true,
+ 'query_var' => 'wporg_experience_level', // Prevent collisions with query params in the archive
+ 'show_ui' => true,
+ 'show_admin_column' => true,
+ 'show_in_nav_menus' => true,
+ 'show_tagcloud' => false,
+ 'show_in_rest' => true,
+ 'capabilities' => array(
+ 'assign_terms' => 'edit_any_learn_content', // See WordPressdotorg\Theme\Learn_2024\Capabilities\map_meta_caps
+ ),
+ );
+
+ register_taxonomy( 'level', array( 'lesson', 'course' ), $args );
+}
+
+/**
+ * Get available taxonomy terms for a post type.
+ *
+ * @param string $taxonomy The taxonomy.
+ * @param string $post_type The post type.
+ * @param string $post_status The post status.
+ * @return array The available taxonomy terms.
+ */
+function get_available_taxonomy_terms( $taxonomy, $post_type, $post_status = null ) {
+ $posts = get_posts( array(
+ 'post_status' => $post_status ?? 'any',
+ 'post_type' => $post_type,
+ 'posts_per_page' => -1,
+ ) );
+
+ if ( empty( $posts ) ) {
+ return array();
+ }
+
+ $term_ids = array();
+ foreach ( $posts as $post ) {
+ $post_terms = wp_get_post_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
+
+ if ( ! is_wp_error( $post_terms ) ) {
+ $term_ids = array_merge( $term_ids, $post_terms );
+ }
+ }
+
+ if ( empty( $term_ids ) ) {
+ return array();
+ }
+
+ $term_ids = array_unique( $term_ids );
+
+ $terms = get_terms( array(
+ 'taxonomy' => $taxonomy,
+ 'include' => $term_ids,
+ 'hide_empty' => false,
+ ) );
+
+ $levels = array();
+ foreach ( $terms as $term ) {
+ $levels[ $term->slug ] = $term->name;
+ }
+
+ return $levels;
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/taxonomy.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2024stylecss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/style.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/style.css 2024-05-03 03:39:01 UTC (rev 13661)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/style.css 2024-05-06 03:38:13 UTC (rev 13662)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,7 +4,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Author: WordPress.org
</span><span class="cx" style="display: block; padding: 0 10px"> * Author URI: http://wordpress.org/
</span><span class="cx" style="display: block; padding: 0 10px"> * Description: A theme for learn.wordpress.org, built in 2024.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Version: 1.0.0-8ace1ca
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Version: 1.0.0-bd61738
</ins><span class="cx" style="display: block; padding: 0 10px"> * License: GNU General Public License v2 or later
</span><span class="cx" style="display: block; padding: 0 10px"> * License URI: http://www.gnu.org/licenses/gpl-2.0.html
</span><span class="cx" style="display: block; padding: 0 10px"> * Text Domain: wporg-learn
</span></span></pre>
</div>
</div>
</body>
</html>