Changeset 13834
- Timestamp:
- 06/19/2024 01:43:38 AM (2 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024
- Files:
-
- 1 added
- 5 edited
-
functions.php (modified) (3 diffs)
-
inc/block-config.php (modified) (2 diffs)
-
inc/query.php (added)
-
patterns/search-content.php (modified) (2 diffs)
-
style.css (modified) (1 diff)
-
templates/search.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php
r13833 r13834 12 12 require_once __DIR__ . '/src/sensei-meta-list/index.php'; 13 13 require_once __DIR__ . '/inc/block-config.php'; 14 require_once __DIR__ . '/inc/query.php'; 14 15 15 16 /** … … 30 31 return $args; 31 32 } ); 32 add_action( 'pre_get_posts', __NAMESPACE__ . '\modify_learning_pathways_query' );33 33 34 34 /** … … 280 280 return $breadcrumbs; 281 281 } 282 283 /**284 * Modify the main query.285 * If the 'all' level filter is set in the query, remove it to return all posts.286 *287 * @param WP_Query $query The main query.288 * @return WP_Query289 */290 function modify_learning_pathways_query( $query ) {291 if ( is_admin() || ! $query->is_main_query() ) {292 return;293 }294 295 $level = $query->get( 'wporg_lesson_level' );296 297 if ( 'all' === $level ) {298 $query->set( 'wporg_lesson_level', '' );299 }300 301 return $query;302 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/block-config.php
r13833 r13834 15 15 add_filter( 'wporg_query_filter_options_taxonomy-topic', __NAMESPACE__ . '\get_taxonomy_topic_options' ); 16 16 add_filter( 'wporg_query_filter_options_learning-pathway-topic', __NAMESPACE__ . '\get_learning_pathway_topic_options' ); 17 add_action( 'pre_get_posts', __NAMESPACE__ . '\modify_query' );18 17 add_action( 'wporg_query_filter_in_form', __NAMESPACE__ . '\inject_other_filters' ); 19 18 … … 389 388 390 389 /** 391 * Modify the query by adding meta query for language if set.392 *393 * @param WP_Query $query The query object.394 */395 function modify_query( $query ) {396 // Ensure this code runs only for the main query on archive pages397 if ( ! is_admin() && $query->is_main_query() && $query->is_archive() ) {398 if ( isset( $_GET['language'] ) && is_array( $_GET['language'] ) ) {399 $languages = array_map( 'sanitize_text_field', $_GET['language'] );400 401 $meta_query = array( 'relation' => 'OR' );402 403 $meta_query[] = array(404 'key' => 'language',405 'value' => $languages,406 'compare' => 'IN',407 );408 409 // If 'en_US' is included, include posts with no language defined410 // as this is the default value for the meta field.411 if ( in_array( 'en_US', $languages ) ) {412 $meta_query[] = array(413 'key' => 'language',414 'compare' => 'NOT EXISTS',415 );416 }417 418 $query->set( 'meta_query', $meta_query );419 }420 }421 }422 423 /**424 390 * Add in the other existing filters as hidden inputs in the filter form. 425 391 * -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/patterns/search-content.php
r13775 r13834 8 8 ?> 9 9 10 <!-- wp: query {"queryId":0,"query":{"inherit":true,"perPage":25},"align":"wide"} -->11 <div class="wp-block- query alignwide">10 <!-- wp:group {"align":"wide","layout":{"type":"flex","flexWrap":"wrap","justifyContent":"space-between"},"style":{"spacing":{"margin":{"top":"0","bottom":"var:preset|spacing|50"}}}} --> 11 <div class="wp-block-group alignwide" style="margin-top:0;margin-bottom:var(--wp--preset--spacing--50)"> 12 12 13 <!-- wp:group {"className":"align-left","layout":{"type":"constrained","contentSize":"","justifyContent":"left"},"style":{"spacing":{"margin":{"bottom":"var:preset|spacing|40"}}}} --> 14 <div class="wp-block-group align-left" style="margin-bottom:var(--wp--preset--spacing--40)"> 13 <!-- wp:search {"label":"<?php esc_attr_e( 'Search', 'wporg-learn' ); ?>","showLabel":false,"placeholder":"<?php esc_attr_e( 'Search learning resources', 'wporg-learn' ); ?>","width":255,"widthUnit":"px","buttonText":"<?php esc_attr_e( 'Search', 'wporg-learn' ); ?>","buttonPosition":"button-inside","buttonUseIcon":true,"className":"is-style-secondary-search-control wporg-filtered-search-form"} /--> 15 14 16 <!-- wp:group {"align":"wide","className":"wporg-search-controls","layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"space-between","verticalAlignment":"top"},"style":{"spacing":{"margin":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}}}} --> 17 <div id="wporg-search" class="wp-block-group alignwide wporg-search-controls" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)"> 18 19 <!-- wp:search {"label":"<?php esc_attr_e( 'Search', 'wporg-learn' ); ?>","showLabel":false,"placeholder":"<?php esc_attr_e( 'Search learning resources', 'wporg-learn' ); ?>","width":232,"widthUnit":"px","buttonText":"<?php esc_attr_e( 'Search', 'wporg-learn' ); ?>","buttonPosition":"button-inside","buttonUseIcon":true,"className":"is-style-secondary-search-control wporg-filtered-search-form"} /--> 20 15 </div> 16 <!-- /wp:group --> 17 18 <!-- wp:wporg-learn/search-results-context {"style":{"spacing":{"padding":{"bottom":"var:preset|spacing|20"}},"elements":{"link":{"color":{"text":"var:preset|color|charcoal-4"}}}},"textColor":"charcoal-4","fontSize":"small"} /--> 19 20 <!-- wp:query {"queryId":1,"query":{"perPage":12,"postType":"course","courseFeatured":false,"inherit":true},"namespace":"wporg-learn/course-grid","align":"wide","className":"wporg-learn-course-grid"} --> 21 <div class="wp-block-query alignwide wporg-learn-course-grid"> 22 23 <!-- wp:post-template {"style":{"spacing":{"blockGap":"var:preset|spacing|50"}},"layout":{"type":"grid","columnCount":null,"minimumColumnWidth":"330px"}} --> 24 25 <!-- wp:group {"style":{"border":{"width":"1px","color":"var:preset|color|light-grey-1","radius":"2px"},"spacing":{"blockGap":"0"},"dimensions":{"minHeight":"100%"}},"backgroundColor":"white","layout":{"type":"flex","orientation":"vertical"}} --> 26 <div class="wp-block-group has-border-color has-white-background-color has-background" style="border-color:var(--wp--preset--color--light-grey-1);border-width:1px;border-radius:2px;min-height:100%"> 27 28 <!-- wp:post-featured-image {"style":{"spacing":{"margin":{"bottom":"0"}}}} /--> 29 30 <!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20","left":"20px","right":"20px"}}},"layout":{"type":"constrained"}} --> 31 <div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--20);padding-right:20px;padding-bottom:var(--wp--preset--spacing--20);padding-left:20px"> 32 33 <!-- wp:post-title {"level":3,"isLink":true,"style":{"typography":{"fontStyle":"normal","fontWeight":"600","lineHeight":1.6},"spacing":{"margin":{"bottom":"0"}},"elements":{"link":{"color":{"text":"var:preset|color|blueberry-1"}}}},"fontSize":"normal","fontFamily":"inter"} /--> 34 35 <!-- wp:post-excerpt {"showMoreOnNewLine":false,"excerptLength":16,"style":{"spacing":{"margin":{"top":"var:preset|spacing|10"}},"typography":{"lineHeight":1.6}}} /--> 36 37 <!-- wp:group {"layout":{"type":"flex","flexWrap":"wrap","justifyContent":"left"}} --> 38 <div class="wp-block-group"> 39 40 <!-- wp:wporg-learn/learning-duration {"style":{"elements":{"link":{"color":{"text":"var:preset|color|charcoal-4"}}}},"textColor":"charcoal-4","fontSize":"small"} /--> 41 42 <!-- wp:wporg-learn/lesson-count {"style":{"layout":{"selfStretch":"fill","flexSize":null}},"fontSize":"extra-small"} /--> 43 44 <!-- wp:wporg-learn/course-status {"fontSize":"extra-small"} /--> 45 46 </div> 47 <!-- /wp:group --> 48 49 </div> 50 <!-- /wp:group --> 51 21 52 </div> 22 53 <!-- /wp:group --> 23 54 24 <!-- wp:wporg-learn/search-results-context {"style":{"spacing":{"padding":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}},"elements":{"link":{"color":{"text":"var:preset|color|charcoal-4"}}}},"textColor":"charcoal-4","fontSize":"small"} /-->55 <!-- /wp:post-template --> 25 56 26 <!-- wp:post-template {"align":"wide"}-->57 <!-- wp:query-no-results --> 27 58 28 <!-- wp:post-title {"isLink":true} /--> 59 <!-- wp:heading {"level":1,"fontFamily":"eb-garamond"} --> 60 <h1 class="wp-block-heading has-eb-garamond-font-family"><?php esc_html_e( 'No results found', 'wporg-learn' ); ?></h1> 61 <!-- /wp:heading --> 29 62 30 <!-- wp:post-excerpt /--> 63 <!-- wp:paragraph {"placeholder":"Add text or blocks that will display when a query returns no results."} --> 64 <p><?php esc_html_e( 'Try a different search, or clearing filters.', 'wporg-learn' ); ?></p> 65 <!-- /wp:paragraph --> 31 66 32 <!-- /wp:post-template --> 33 34 <!-- wp:query-no-results --> 35 36 <!-- wp:paragraph {"placeholder":"Add text or blocks that will display when a query returns no results.","style":{"spacing":{"margin":{"top":"var:preset|spacing|40"}}}} --> 37 <p style="margin-top:var(--wp--preset--spacing--40)"><?php esc_attr_e( 'Sorry, but nothing matched your search terms.', 'wporg-learn' ); ?></p> 38 <!-- /wp:paragraph --> 39 40 <!-- /wp:query-no-results --> 41 42 </div> 43 <!-- /wp:group --> 67 <!-- /wp:query-no-results --> 44 68 45 69 <!-- wp:query-pagination {"layout":{"type":"flex","justifyContent":"center"}} --> 70 46 71 <!-- wp:query-pagination-previous {"label":"Previous"} /--> 47 72 … … 49 74 50 75 <!-- wp:query-pagination-next {"label":"Next"} /--> 76 51 77 <!-- /wp:query-pagination --> 52 78 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/style.css
r13833 r13834 5 5 * Author URI: http://wordpress.org/ 6 6 * Description: A theme for learn.wordpress.org, built in 2024. 7 * Version: 1.0.0- 8e530217 * Version: 1.0.0-09d8faa 8 8 * License: GNU General Public License v2 or later 9 9 * License URI: http://www.gnu.org/licenses/gpl-2.0.html -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/templates/search.html
r13775 r13834 4 4 <main class="wp-block-group alignfull" style="padding-left:var(--wp--preset--spacing--edge-space);padding-right:var(--wp--preset--spacing--edge-space)"> 5 5 6 <!-- wp:pattern {"slug":"wporg-learn-2024/search-content"} /--> 6 <!-- wp:group {"align":"full","style":{"spacing":{"padding":{"left":"var:preset|spacing|edge-space","right":"var:preset|spacing|edge-space","top":"var:preset|spacing|50","bottom":"var:preset|spacing|50"}}},"layout":{"type":"constrained"}} --> 7 <div class="wp-block-group alignfull" style="padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--edge-space);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--edge-space)"> 8 9 <!-- wp:pattern {"slug":"wporg-learn-2024/search-content"} /--> 10 11 </div> 12 <!-- /wp:group --> 7 13 8 14 </main>
Note:
See TracChangeset
for help on using the changeset viewer.