From 8e5302189821b676d0d5e9fada5ede694ee5366f Mon Sep 17 00:00:00 2001 From: Adam Wood <1017872+adamwoodnz@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:26:42 +1200 Subject: [PATCH] Add query filters to taxonomy templates (#2530) * Add topic filter to learning pathway template * Add level filter to learning pathway template * Style the learning pathway header when loaded on level and topic tax pages * Extract learning pathway header into a block for reuse * Make Level filter a single select * Correct filter titles * Fix the header alignment config * Fix undefined var in taxonomy content pattern * Branch the level filter option creation at the template level This turns out to be simpler than trying to use conditionals like is_tax within a single get_level_options function * Enable clearing level selection using All option * Modify filter input injection to handle single select filters * Fix topic filtering on course and lesson archives * Remove count limit on level filter Even if there is only 1 level set, that can be used to filter vs all * Remove language filter from Learning Pathway header * Fix incorrect get_posts args * Make getting options by post type safe * Make see all links match level filter behaviour * Fix filter padding --- .../themes/pub/wporg-learn-2024/functions.php | 23 ++ .../pub/wporg-learn-2024/inc/block-config.php | 311 ++++++++++++++---- .../patterns/archive-content.php | 2 +- .../patterns/archive-courses-content.php | 2 +- .../patterns/archive-lesson-plan-content.php | 2 +- .../patterns/archive-lessons-content.php | 2 +- .../patterns/taxonomy-content.php | 112 +++++++ .../taxonomy-learning-pathway-content.php | 47 +-- .../src/learning-pathway-header/block.json | 32 ++ .../src/learning-pathway-header/index.js | 18 + .../src/learning-pathway-header/index.php | 113 +++++++ .../src/learning-pathway-header/style.scss | 6 + .../src/style/_taxonomy-learning-pathway.scss | 13 - .../wporg-learn-2024/src/style/_taxonomy.scss | 9 + .../pub/wporg-learn-2024/src/style/style.scss | 2 +- .../wporg-learn-2024/templates/taxonomy.html | 11 + .../themes/pub/wporg-learn-2024/theme.json | 3 +- 17 files changed, 584 insertions(+), 124 deletions(-) create mode 100644 wp-content/themes/pub/wporg-learn-2024/patterns/taxonomy-content.php create mode 100644 wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/block.json create mode 100644 wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/index.js create mode 100644 wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/index.php create mode 100644 wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/style.scss delete mode 100644 wp-content/themes/pub/wporg-learn-2024/src/style/_taxonomy-learning-pathway.scss create mode 100644 wp-content/themes/pub/wporg-learn-2024/src/style/_taxonomy.scss create mode 100644 wp-content/themes/pub/wporg-learn-2024/templates/taxonomy.html diff --git a/wp-content/themes/pub/wporg-learn-2024/functions.php b/wp-content/themes/pub/wporg-learn-2024/functions.php index ed5e72b22..34bfcb820 100644 --- a/wp-content/themes/pub/wporg-learn-2024/functions.php +++ b/wp-content/themes/pub/wporg-learn-2024/functions.php @@ -6,6 +6,7 @@ // Block files require_once __DIR__ . '/src/learning-pathway-cards/index.php'; +require_once __DIR__ . '/src/learning-pathway-header/index.php'; require_once __DIR__ . '/src/search-results-context/index.php'; require_once __DIR__ . '/src/upcoming-online-workshops/index.php'; require_once __DIR__ . '/src/sensei-meta-list/index.php'; @@ -28,6 +29,7 @@ $args['has_archive'] = 'courses'; return $args; } ); +add_action( 'pre_get_posts', __NAMESPACE__ . '\modify_learning_pathways_query' ); /** * Modify the single template hierarchy to use customised copies of the Sensei Course Theme templates. @@ -277,3 +279,24 @@ function set_site_breadcrumbs( $breadcrumbs ) { return $breadcrumbs; } + +/** + * Modify the main query. + * If the 'all' level filter is set in the query, remove it to return all posts. + * + * @param WP_Query $query The main query. + * @return WP_Query + */ +function modify_learning_pathways_query( $query ) { + if ( is_admin() || ! $query->is_main_query() ) { + return; + } + + $level = $query->get( 'wporg_lesson_level' ); + + if ( 'all' === $level ) { + $query->set( 'wporg_lesson_level', '' ); + } + + return $query; +} diff --git a/wp-content/themes/pub/wporg-learn-2024/inc/block-config.php b/wp-content/themes/pub/wporg-learn-2024/inc/block-config.php index b488207b3..9507d6b3f 100644 --- a/wp-content/themes/pub/wporg-learn-2024/inc/block-config.php +++ b/wp-content/themes/pub/wporg-learn-2024/inc/block-config.php @@ -9,7 +9,11 @@ add_filter( 'wporg_query_filter_options_language', __NAMESPACE__ . '\get_language_options' ); add_filter( 'wporg_query_filter_options_level', __NAMESPACE__ . '\get_level_options' ); +add_filter( 'wporg_query_filter_options_taxonomy-level', __NAMESPACE__ . '\get_taxonomy_level_options' ); +add_filter( 'wporg_query_filter_options_learning-pathway-level', __NAMESPACE__ . '\get_learning_pathway_level_options' ); add_filter( 'wporg_query_filter_options_topic', __NAMESPACE__ . '\get_topic_options' ); +add_filter( 'wporg_query_filter_options_taxonomy-topic', __NAMESPACE__ . '\get_taxonomy_topic_options' ); +add_filter( 'wporg_query_filter_options_learning-pathway-topic', __NAMESPACE__ . '\get_learning_pathway_topic_options' ); add_action( 'pre_get_posts', __NAMESPACE__ . '\modify_query' ); add_action( 'wporg_query_filter_in_form', __NAMESPACE__ . '\inject_other_filters' ); @@ -23,6 +27,69 @@ function get_current_url() { return home_url( add_query_arg( array(), $wp->request ) ); } +/** + * Create level options. + * + * @param array $levels The filtered levels for a view. + * @return array The options for a level filter. + */ +function create_level_options( $levels ) { + global $wp_query; + + // If there are no levels, don't show the filter. + if ( empty( $levels ) ) { + return array(); + } + + // Sort the levels alphabetically. + usort( + $levels, + function ( $a, $b ) { + return strcmp( strtolower( $a->name ), strtolower( $b->name ) ); + } + ); + + // Add an 'All' option to the top. + $levels = array_merge( + array( + 'all' => (object) array( + 'slug' => 'all', + 'name' => __( 'All', 'wporg-learn' ), + ), + ), + $levels, + ); + + $label = __( 'Level', 'wporg-learn' ); + + $selected_slug = $wp_query->get( 'wporg_lesson_level' ); + if ( $selected_slug ) { + // Find the selected level from $levels by slug and then get the name. + $selected_level = array_filter( + $levels, + function ( $level ) use ( $selected_slug ) { + return $level->slug === $selected_slug; + } + ); + if ( ! empty( $selected_level ) ) { + $selected_level = array_shift( $selected_level ); + $label = $selected_level->name; + } + } else { + $selected_slug = 'all'; + $label = __( 'All', 'wporg-learn' ); + } + + return array( + 'label' => $label, + 'title' => __( 'Level', 'wporg-learn' ), + 'key' => 'wporg_lesson_level', + 'action' => get_current_url(), + 'options' => array_combine( wp_list_pluck( $levels, 'slug' ), wp_list_pluck( $levels, 'name' ) ), + 'selected' => array( $selected_slug ), + ); +} + /** * Get the list of levels for the course and lesson filters. * @@ -31,14 +98,18 @@ function get_current_url() { */ function get_level_options( $options ) { global $wp_query; - $post_type = $wp_query->query_vars['post_type']; - // Get top 10 levels ordered by count, not empty, filtered by post_type, then sort them alphabetically. + + if ( ! isset( $wp_query->query_vars['post_type'] ) ) { + return array(); + } + + // Get top 10 levels ordered by count, not empty, filtered by post_type. $object_ids = get_posts( array( - 'post_type' => $post_type, + 'post_type' => $wp_query->query_vars['post_type'], 'fields' => 'ids', - 'numberposts' => -1, - 'status' => 'publish', + 'posts_per_page' => -1, + 'post_status' => 'publish', ) ); $levels = get_terms( @@ -51,84 +122,89 @@ function get_level_options( $options ) { 'object_ids' => $object_ids, ) ); - // If there are no levels, or less than 2, don't show the filter. - if ( empty( $levels ) || count( $levels ) < 2 ) { - return array(); - } - - usort( - $levels, - function ( $a, $b ) { - return strcmp( strtolower( $a->name ), strtolower( $b->name ) ); - } - ); - // Move the level with value 'Any' to the top, if it exists. - $any_level = array_filter( - $levels, - function ( $level ) { - return 'Any' === $level->name; - } - ); - if ( ! empty( $any_level ) ) { - $target_key = key( $any_level ); - $target_element = array( $target_key => $levels[ $target_key ] ); - unset( $levels[ $target_key ] ); - - $levels = $target_element + $levels; - } + return create_level_options( $levels ); +} - $selected = isset( $wp_query->query['wporg_lesson_level'] ) ? (array) $wp_query->query['wporg_lesson_level'] : array(); - $count = count( $selected ); - $label = sprintf( - /* translators: The dropdown label for filtering, %s is the selected term count. */ - _n( 'Level %s', 'Level %s', $count, 'wporg-learn' ), - $count +/** + * Get the list of levels for the taxonomy filters. + * + * @param array $options The options for this filter. + * @return array New list of level options. + */ +function get_taxonomy_level_options( $options ) { + // Get top 10 levels ordered by count, not empty. + $levels = get_terms( + array( + 'taxonomy' => 'level', + 'orderby' => 'count', + 'order' => 'DESC', + 'number' => 10, + 'hide_empty' => true, + ) ); - return array( - 'label' => $label, - 'title' => __( 'Level', 'wporg-learn' ), - 'key' => 'wporg_lesson_level', - 'action' => get_current_url(), - 'options' => array_combine( wp_list_pluck( $levels, 'slug' ), wp_list_pluck( $levels, 'name' ) ), - 'selected' => $selected, - ); + return create_level_options( $levels ); } /** - * Get the list of topics for the course and lesson filters. + * Get the list of levels for the learning pathway filters. * * @param array $options The options for this filter. - * @return array New list of topic options. + * @return array New list of level options. */ -function get_topic_options( $options ) { +function get_learning_pathway_level_options( $options ) { global $wp_query; - $post_type = $wp_query->query_vars['post_type']; - // Get top 20 topics ordered by count, not empty, filtered by post_type, then sort them alphabetically. + + if ( ! isset( $wp_query->query_vars['wporg_learning_pathway'] ) ) { + return array(); + } + + // Get top 10 levels ordered by count, not empty, filtered by post_type. $object_ids = get_posts( array( - 'post_type' => $post_type, 'fields' => 'ids', - 'numberposts' => -1, - 'status' => 'publish', + 'posts_per_page' => -1, + 'post_status' => 'publish', + 'post_type' => 'course', + 'tax_query' => array( + array( + 'taxonomy' => 'learning-pathway', + 'field' => 'slug', + 'terms' => $wp_query->query_vars['wporg_learning_pathway'], + ), + ), ) ); - $topics = get_terms( + $levels = get_terms( array( - 'taxonomy' => 'topic', + 'taxonomy' => 'level', 'orderby' => 'count', 'order' => 'DESC', - 'number' => 20, + 'number' => 10, 'hide_empty' => true, 'object_ids' => $object_ids, ) ); + + return create_level_options( $levels ); +} + +/** + * Create topic options. + * + * @param array $topics The filtered topics for a view. + * @return array The options for a topic filter. + */ +function create_topic_options( $topics ) { + global $wp_query; + // If there are no topics, or less than 2, don't show the filter. if ( empty( $topics ) || count( $topics ) < 2 ) { return array(); } + // Sort the topics alphabetically. usort( $topics, function ( $a, $b ) { @@ -146,7 +222,7 @@ function ( $a, $b ) { return array( 'label' => $label, - 'title' => __( 'Topic', 'wporg-learn' ), + 'title' => __( 'Filter', 'wporg-learn' ), 'key' => 'wporg_workshop_topic', 'action' => get_current_url(), 'options' => array_combine( wp_list_pluck( $topics, 'slug' ), wp_list_pluck( $topics, 'name' ) ), @@ -154,6 +230,103 @@ function ( $a, $b ) { ); } +/** + * Get the list of topics for the course and lesson filters. + * + * @param array $options The options for this filter. + * @return array New list of topic options. + */ +function get_topic_options( $options ) { + global $wp_query; + + if ( ! isset( $wp_query->query_vars['post_type'] ) ) { + return array(); + } + + // Get top 20 topics ordered by count, not empty, filtered by post_type. + $object_ids = get_posts( array( + 'fields' => 'ids', + 'posts_per_page' => -1, + 'post_status' => 'publish', + 'post_type' => $wp_query->query_vars['post_type'], + ) ); + $topics = get_terms( + array( + 'taxonomy' => 'topic', + 'orderby' => 'count', + 'order' => 'DESC', + 'number' => 20, + 'hide_empty' => true, + 'object_ids' => $object_ids, + ) + ); + + return create_topic_options( $topics ); +} + +/** + * Get the list of topics for the taxonomy filters. + * + * @param array $options The options for this filter. + * @return array New list of topic options. + */ +function get_taxonomy_topic_options( $options ) { + // Get top 20 topics ordered by count, not empty. + $topics = get_terms( + array( + 'taxonomy' => 'topic', + 'orderby' => 'count', + 'order' => 'DESC', + 'number' => 20, + 'hide_empty' => true, + ) + ); + + return create_topic_options( $topics ); +} + +/** + * Get the list of topics for the learning pathway filters. + * + * @param array $options The options for this filter. + * @return array New list of topic options. + */ +function get_learning_pathway_topic_options( $options ) { + global $wp_query; + + if ( ! isset( $wp_query->query_vars['wporg_learning_pathway'] ) ) { + return array(); + } + + // Get top 20 topics ordered by count, not empty, filtered by post_type. + $object_ids = get_posts( + array( + 'fields' => 'ids', + 'posts_per_page' => -1, + 'post_status' => 'publish', + 'post_type' => 'course', + 'tax_query' => array( + array( + 'taxonomy' => 'learning-pathway', + 'field' => 'slug', + 'terms' => $wp_query->query_vars['wporg_learning_pathway'], + ), + ), + ) + ); + $topics = get_terms( + array( + 'taxonomy' => 'topic', + 'orderby' => 'count', + 'order' => 'DESC', + 'number' => 20, + 'hide_empty' => true, + 'object_ids' => $object_ids, + ) + ); + + return create_topic_options( $topics ); +} /** * Get the meta query values by key. @@ -206,7 +379,7 @@ function get_language_options( $options ) { return array( 'label' => $label, - 'title' => __( 'Language', 'wporg-learn' ), + 'title' => __( 'Filter', 'wporg-learn' ), 'key' => 'language', 'action' => get_current_url(), 'options' => $languages, @@ -259,17 +432,29 @@ function modify_query( $query ) { function inject_other_filters( $key ) { global $wp_query; - $query_vars = array( 'wporg_workshop_topic', 'wporg_lesson_level' ); - foreach ( $query_vars as $query_var ) { - if ( ! isset( $wp_query->query[ $query_var ] ) ) { + $single_query_vars = array( 'wporg_lesson_level' ); + foreach ( $single_query_vars as $single_query_var ) { + if ( ! isset( $wp_query->query[ $single_query_var ] ) ) { + continue; + } + if ( $key === $single_query_var ) { + continue; + } + $value = $wp_query->query[ $single_query_var ]; + printf( '', esc_attr( $single_query_var ), esc_attr( $value ) ); + } + + $multi_query_vars = array( 'wporg_workshop_topic' ); + foreach ( $multi_query_vars as $multi_query_var ) { + if ( ! isset( $wp_query->query[ $multi_query_var ] ) ) { continue; } - if ( $key === $query_var ) { + if ( $key === $multi_query_var ) { continue; } - $values = (array) $wp_query->query[ $query_var ]; + $values = (array) $wp_query->query[ $multi_query_var ]; foreach ( $values as $value ) { - printf( '', esc_attr( $query_var ), esc_attr( $value ) ); + printf( '', esc_attr( $multi_query_var ), esc_attr( $value ) ); } } diff --git a/wp-content/themes/pub/wporg-learn-2024/patterns/archive-content.php b/wp-content/themes/pub/wporg-learn-2024/patterns/archive-content.php index c09752e2c..d9ed56d81 100644 --- a/wp-content/themes/pub/wporg-learn-2024/patterns/archive-content.php +++ b/wp-content/themes/pub/wporg-learn-2024/patterns/archive-content.php @@ -24,7 +24,7 @@
- +
diff --git a/wp-content/themes/pub/wporg-learn-2024/patterns/archive-courses-content.php b/wp-content/themes/pub/wporg-learn-2024/patterns/archive-courses-content.php index c995b221c..bc8547164 100644 --- a/wp-content/themes/pub/wporg-learn-2024/patterns/archive-courses-content.php +++ b/wp-content/themes/pub/wporg-learn-2024/patterns/archive-courses-content.php @@ -28,7 +28,7 @@
- +
diff --git a/wp-content/themes/pub/wporg-learn-2024/patterns/archive-lesson-plan-content.php b/wp-content/themes/pub/wporg-learn-2024/patterns/archive-lesson-plan-content.php index c4e1c35d4..28926eb42 100644 --- a/wp-content/themes/pub/wporg-learn-2024/patterns/archive-lesson-plan-content.php +++ b/wp-content/themes/pub/wporg-learn-2024/patterns/archive-lesson-plan-content.php @@ -28,7 +28,7 @@
- +
diff --git a/wp-content/themes/pub/wporg-learn-2024/patterns/archive-lessons-content.php b/wp-content/themes/pub/wporg-learn-2024/patterns/archive-lessons-content.php index b7a6a4e8a..ed11fd86b 100644 --- a/wp-content/themes/pub/wporg-learn-2024/patterns/archive-lessons-content.php +++ b/wp-content/themes/pub/wporg-learn-2024/patterns/archive-lessons-content.php @@ -28,7 +28,7 @@
- +
diff --git a/wp-content/themes/pub/wporg-learn-2024/patterns/taxonomy-content.php b/wp-content/themes/pub/wporg-learn-2024/patterns/taxonomy-content.php new file mode 100644 index 000000000..463f9be93 --- /dev/null +++ b/wp-content/themes/pub/wporg-learn-2024/patterns/taxonomy-content.php @@ -0,0 +1,112 @@ +query_vars['wporg_learning_pathway'] ) ) { + $learning_pathway_slug = $wp_query->query_vars['wporg_learning_pathway']; + ?> + + + + + + +
+ + + + +
+ + + +
+ + + +
+ + + + +
+ + + +
+ + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + + + +
+ + + + + + + +
+ + +
+ + +
+ + + + + + + +

+ + + + + + + + + + + + + + +
+ + +
+ diff --git a/wp-content/themes/pub/wporg-learn-2024/patterns/taxonomy-learning-pathway-content.php b/wp-content/themes/pub/wporg-learn-2024/patterns/taxonomy-learning-pathway-content.php index a6c307b75..bf6596ee8 100644 --- a/wp-content/themes/pub/wporg-learn-2024/patterns/taxonomy-learning-pathway-content.php +++ b/wp-content/themes/pub/wporg-learn-2024/patterns/taxonomy-learning-pathway-content.php @@ -19,6 +19,7 @@ $learning_pathway_id = $learning_pathway_object->term_id; $learning_pathway_slug = $learning_pathway_object->slug; +$learning_pathway_url = get_term_link( $learning_pathway_object ); $beginner_level_id = get_term_by( 'slug', 'beginner', 'level' )->term_id; $intermediate_level_id = get_term_by( 'slug', 'intermediate', 'level' )->term_id; @@ -27,45 +28,7 @@ $content = get_learning_pathway_level_content( $learning_pathway_slug ); ?> - -
- - -
- - -
- - - - - -
- - - -
- - -
- - -
- - - -
- - - - - -
- +
@@ -82,7 +45,7 @@ - +
@@ -148,7 +111,7 @@ - + @@ -214,7 +177,7 @@ - + diff --git a/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/block.json b/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/block.json new file mode 100644 index 000000000..61f7cfa47 --- /dev/null +++ b/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/block.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 2, + "name": "wporg-learn/learning-pathway-header", + "version": "0.1.0", + "title": "Learning Pathway Header", + "category": "widgets", + "icon": "smiley", + "description": "Shows the header for a Learning Pathway taxonomy page", + "usesContext": [], + "attributes": { + "learningPathwaySlug": { + "type": "string", + "default": "" + } + }, + "supports": { + "html": false, + "spacing": { + "margin": [ + "bottom" + ] + }, + "align": [ + "wide", + "full" + ] + }, + "textdomain": "wporg-learn", + "editorScript": "file:./index.js", + "style": "file:./style-index.css" +} diff --git a/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/index.js b/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/index.js new file mode 100644 index 000000000..26d63bc5a --- /dev/null +++ b/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/index.js @@ -0,0 +1,18 @@ +/** + * WordPress dependencies + */ +import { registerBlockType } from '@wordpress/blocks'; + +/** + * Internal dependencies + */ +import Edit from '../shared/dynamic-edit'; +import metadata from './block.json'; +import './style.scss'; + +registerBlockType( metadata.name, { + /** + * @see ./edit.js + */ + edit: Edit, +} ); diff --git a/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/index.php b/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/index.php new file mode 100644 index 000000000..3b0cac55a --- /dev/null +++ b/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/index.php @@ -0,0 +1,113 @@ + __NAMESPACE__ . '\render', + ) + ); +} + +/** + * Render the block content. + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the block markup. + */ +function render( $attributes, $content, $block ) { + $learning_pathway_slug = $attributes['learningPathwaySlug']; + + if ( ! $learning_pathway_slug ) { + return ''; + } + + global $wp_query; + + // If this is the learning pathway taxonomy archive page, we can use the queried object. + // On a different taxonomy archive page, we need to fetch the term by slug. + if ( isset( $wp_query->queried_object->slug ) && $wp_query->queried_object->slug === $learning_pathway_slug ) { + $learning_pathway_object = $wp_query->queried_object; + } else { + $learning_pathway_object = get_term_by( 'slug', $learning_pathway_slug, 'learning-pathway' ); + } + + if ( ! $learning_pathway_object ) { + return ''; + } + + $learning_pathway_id = $learning_pathway_object->term_id; + $learning_pathway_name = $learning_pathway_object->name; + $learning_pathway_description = $learning_pathway_object->description; + + $content = ' +
+ + +
+ + +
+ + +

' . esc_html( $learning_pathway_name ) . '

+ + + +

' . esc_html( $learning_pathway_description ) . '

+ + +
+ + + +
+ + +
+ + +
+ + + +
+ + +
+ + + + +
+ + +
+ + +
+ + +
+ '; + + $wrapper_attributes = get_block_wrapper_attributes(); + return sprintf( + '
%2$s
', + $wrapper_attributes, + do_blocks( $content ) + ); +} diff --git a/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/style.scss b/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/style.scss new file mode 100644 index 000000000..73e715b5c --- /dev/null +++ b/wp-content/themes/pub/wporg-learn-2024/src/learning-pathway-header/style.scss @@ -0,0 +1,6 @@ +.wp-block-wporg-learn-learning-pathway-header .wp-block-wporg-learn-learning-pathway-header-content { + + @media screen and (max-width: 1024px) { + padding-right: unset !important; + } +} diff --git a/wp-content/themes/pub/wporg-learn-2024/src/style/_taxonomy-learning-pathway.scss b/wp-content/themes/pub/wporg-learn-2024/src/style/_taxonomy-learning-pathway.scss deleted file mode 100644 index ca2302f7c..000000000 --- a/wp-content/themes/pub/wporg-learn-2024/src/style/_taxonomy-learning-pathway.scss +++ /dev/null @@ -1,13 +0,0 @@ -.tax-learning-pathway { - - @media screen and (min-width: 769px) { - --wp--preset--font-size--heading-1: 50px; - } - - .wporg-learn-tax-learning-pathway-header { - - @media screen and (max-width: 1024px) { - padding-right: unset !important; - } - } -} diff --git a/wp-content/themes/pub/wporg-learn-2024/src/style/_taxonomy.scss b/wp-content/themes/pub/wporg-learn-2024/src/style/_taxonomy.scss new file mode 100644 index 000000000..40c88c47f --- /dev/null +++ b/wp-content/themes/pub/wporg-learn-2024/src/style/_taxonomy.scss @@ -0,0 +1,9 @@ +.tax-learning-pathway, +.tax-topic, +.tax-level { + + @media screen and (min-width: 769px) { + --wp--preset--font-size--heading-1: 50px; + --wp--custom--heading--level-1--typography--line-height: 1.2; + } +} diff --git a/wp-content/themes/pub/wporg-learn-2024/src/style/style.scss b/wp-content/themes/pub/wporg-learn-2024/src/style/style.scss index 885e297f3..83ecb5ffb 100644 --- a/wp-content/themes/pub/wporg-learn-2024/src/style/style.scss +++ b/wp-content/themes/pub/wporg-learn-2024/src/style/style.scss @@ -10,7 +10,7 @@ @import "sensei"; @import "sidebar"; @import "tag"; -@import "taxonomy-learning-pathway"; +@import "taxonomy"; @import "wp-components"; @import "wporg-meeting-calendar"; diff --git a/wp-content/themes/pub/wporg-learn-2024/templates/taxonomy.html b/wp-content/themes/pub/wporg-learn-2024/templates/taxonomy.html new file mode 100644 index 000000000..b97344eae --- /dev/null +++ b/wp-content/themes/pub/wporg-learn-2024/templates/taxonomy.html @@ -0,0 +1,11 @@ + + + +
+ + + +
+ + + diff --git a/wp-content/themes/pub/wporg-learn-2024/theme.json b/wp-content/themes/pub/wporg-learn-2024/theme.json index 42243a088..ddef07675 100644 --- a/wp-content/themes/pub/wporg-learn-2024/theme.json +++ b/wp-content/themes/pub/wporg-learn-2024/theme.json @@ -176,7 +176,8 @@ "typography": { "fontFamily": "var(--wp--preset--font-family--eb-garamond)", "fontSize": "36px", - "lineHeight": "1.3" + "lineHeight": "1.3", + "fontWeight": "400" } } },