Sfoglia il codice sorgente

Merge pull request #2366 from Automattic/try/seedlet-support-archive-filter

Seedlet: support filtering archive page titles
Ben Dwyer 4 anni fa
parent
commit
e86d366c7b

+ 1 - 1
seedlet/archive.php

@@ -18,7 +18,7 @@ get_header();
 
 			<header class="page-header default-max-width">
 				<?php
-					the_archive_title( '<h1 class="page-title">', '</h1>' );
+					the_archive_title();
 				?>
 			</header><!-- .page-header -->
 

+ 1 - 1
seedlet/assets/sass/style.scss

@@ -4,7 +4,7 @@ Theme URI: https://wordpress.com/theme/seedlet
 Author: Automattic
 Author URI: https://automattic.com/
 Description: Seedlet is a free WordPress theme. A two-column layout and classically elegant typography creates a refined site that gives your works and images space to breathe - and shine. Seedlet was built to be the perfect partner to the block editor, and supports all the latest blocks. Writing, audio, illustrations, photography, video - use Seedlet to engage and direct visitors' eyes, without your theme getting in the way. And the responsive design shifts naturally between desktop and mobile devices. Seedlet is a great option for professionals and creatives looking for a sophisticated vibe. Whether you're looking to create a blog or a robust site promoting your business, do with simplicity, style, and Seedlet.
-Requires at least: 4.9.6
+Requires at least: 5.5.0
 Tested up to: 5.5
 Requires PHP: 5.6.2
 Version: 1.1.2-wpcom

+ 1 - 8
seedlet/functions.php

@@ -108,18 +108,11 @@ if ( ! function_exists( 'seedlet_setup' ) ) :
 
 		$editor_stylesheet_path = './assets/css/style-editor.css';
 
-		// Note, the is_IE global variable is defined by WordPress and is used
-		// to detect if the current browser is internet explorer.
-		global $is_IE;
-		if ( $is_IE ) {
-			$editor_stylesheet_path = './assets/css/ie-editor.css';
-		}
-
 		// Enqueue editor styles.
 		add_editor_style(
 			array(
 				seedlet_fonts_url(),
-				$editor_stylesheet_path,
+				'./assets/css/style-editor.css',
 			)
 		);
 

+ 20 - 10
seedlet/inc/template-functions.php

@@ -75,37 +75,47 @@ add_filter( 'comment_form_defaults', 'seedlet_comment_form_defaults' );
 /**
  * Filters the default archive titles.
  */
-function seedlet_get_the_archive_title() {
+function seedlet_get_the_archive_title( $title, $original_title, $prefix ) {
 	if ( is_category() ) {
-		$title = __( 'Category Archives: ', 'seedlet' ) . '<span class="page-description">' . single_term_title( '', false ) . '</span>';
+		$prefix = '<span class="archive-prefix">' . __( 'Category Archives: ', 'seedlet' ) . '</span>';
+		$title 	= '<span class="page-description">' . single_term_title( '', false ) . '</span>';
 	} elseif ( is_tag() ) {
-		$title = __( 'Tag Archives: ', 'seedlet' ) . '<span class="page-description">' . single_term_title( '', false ) . '</span>';
+		$prefix = '<span class="archive-prefix">' . __( 'Tag Archives: ', 'seedlet' ) . ' </span>';
+		$title 	= '<span class="page-description">' . single_term_title( '', false ) . '</span>';
 	} elseif ( is_author() ) {
-		$title = __( 'Author Archives: ', 'seedlet' ) . '<span class="page-description">' . get_the_author_meta( 'display_name' ) . '</span>';
+		$prefix = '<span class="archive-prefix">' . __( 'Author Archives: ', 'seedlet' ) . ' </span>';
+		$title 	= '<span class="page-description">' . get_the_author_meta( 'display_name' ) . '</span>';
 	} elseif ( is_year() ) {
-		$title = __( 'Yearly Archives: ', 'seedlet' ) . '<span class="page-description">' . get_the_date( _x( 'Y', 'yearly archives date format', 'seedlet' ) ) . '</span>';
+		$prefix = '<span class="archive-prefix">' . __( 'Yearly Archives: ', 'seedlet' ) . ' </span>';
+		$title 	= '<span class="page-description">' . get_the_date( _x( 'Y', 'yearly archives date format', 'seedlet' ) ) . '</span>';
 	} elseif ( is_month() ) {
-		$title = __( 'Monthly Archives: ', 'seedlet' ) . '<span class="page-description">' . get_the_date( _x( 'F Y', 'monthly archives date format', 'seedlet' ) ) . '</span>';
+		$prefix = '<span class="archive-prefix">' . __( 'Monthly Archives: ', 'seedlet' ) . ' </span>';
+		$title 	= '<span class="page-description">' . get_the_date( _x( 'F Y', 'monthly archives date format', 'seedlet' ) ) . '</span>';
 	} elseif ( is_day() ) {
-		$title = __( 'Daily Archives: ', 'seedlet' ) . '<span class="page-description">' . get_the_date() . '</span>';
+		$prefix = '<span class="archive-prefix">' . __( 'Daily Archives: ', 'seedlet' ) . ' </span>';
+		$title 	= '<span class="page-description">' . get_the_date() . '</span>';
 	} elseif ( is_post_type_archive() ) {
+		$prefix = '';
 		$cpt = get_post_type_object( get_queried_object()->name );
 		/* translators: %s: Post type singular name */
 		$title = sprintf( esc_html__( '%s Archives', 'seedlet' ),
 			$cpt->labels->singular_name
 		);
 	} elseif ( is_tax() ) {
+		$prefix = '';
 		$tax = get_taxonomy( get_queried_object()->taxonomy );
 		/* translators: %s: Taxonomy singular name */
 		$title = sprintf( esc_html__( '%s Archives', 'seedlet' ),
 			$tax->labels->singular_name
 		);
 	} else {
-		$title = __( 'Archives:', 'seedlet' );
+		$prefix = '';
+		$title 	= '<span class="archive-prefix">' . __( 'Archives: ', 'seedlet' ) . ' </span>';
 	}
-	return $title;
+
+	return '<h1 class="page-title">' . $prefix . $title . '</h1>';
 }
-add_filter( 'get_the_archive_title', 'seedlet_get_the_archive_title' );
+add_filter( 'get_the_archive_title', 'seedlet_get_the_archive_title', 10, 3 );
 
 /**
  * Determines if post thumbnail can be displayed.

+ 1 - 1
seedlet/style-rtl.css

@@ -4,7 +4,7 @@ Theme URI: https://wordpress.com/theme/seedlet
 Author: Automattic
 Author URI: https://automattic.com/
 Description: Seedlet is a free WordPress theme. A two-column layout and classically elegant typography creates a refined site that gives your works and images space to breathe - and shine. Seedlet was built to be the perfect partner to the block editor, and supports all the latest blocks. Writing, audio, illustrations, photography, video - use Seedlet to engage and direct visitors' eyes, without your theme getting in the way. And the responsive design shifts naturally between desktop and mobile devices. Seedlet is a great option for professionals and creatives looking for a sophisticated vibe. Whether you're looking to create a blog or a robust site promoting your business, do with simplicity, style, and Seedlet.
-Requires at least: 4.9.6
+Requires at least: 5.5.0
 Tested up to: 5.5
 Requires PHP: 5.6.2
 Version: 1.1.3-wpcom

+ 1 - 1
seedlet/style.css

@@ -4,7 +4,7 @@ Theme URI: https://wordpress.com/theme/seedlet
 Author: Automattic
 Author URI: https://automattic.com/
 Description: Seedlet is a free WordPress theme. A two-column layout and classically elegant typography creates a refined site that gives your works and images space to breathe - and shine. Seedlet was built to be the perfect partner to the block editor, and supports all the latest blocks. Writing, audio, illustrations, photography, video - use Seedlet to engage and direct visitors' eyes, without your theme getting in the way. And the responsive design shifts naturally between desktop and mobile devices. Seedlet is a great option for professionals and creatives looking for a sophisticated vibe. Whether you're looking to create a blog or a robust site promoting your business, do with simplicity, style, and Seedlet.
-Requires at least: 4.9.6
+Requires at least: 5.5.0
 Tested up to: 5.5
 Requires PHP: 5.6.2
 Version: 1.1.3-wpcom