Jeff Ong пре 4 година
родитељ
комит
12d1b1ec32
3 измењених фајлова са 21 додато и 3 уклоњено
  1. 1 1
      seedlet/archive.php
  2. 7 2
      seedlet/inc/template-functions.php
  3. 13 0
      seedlet/inc/template-tags.php

+ 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 -->
 

+ 7 - 2
seedlet/inc/template-functions.php

@@ -75,7 +75,7 @@ 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>';
 	} elseif ( is_tag() ) {
@@ -104,8 +104,13 @@ function seedlet_get_the_archive_title() {
 		$title = __( 'Archives:', 'seedlet' );
 	}
 	return $title;
+
+	$prefix = '<span class="archive-prefix">' . $prefix . '</span>';
+	$title 	= '<span class="archive-title">' . $original_title . '</span>';
+
+	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.

+ 13 - 0
seedlet/inc/template-tags.php

@@ -240,3 +240,16 @@ if ( ! function_exists( 'seedlet_the_posts_pagination' ) ) :
 		);
 	}
 endif;
+
+if ( ! function_exists( 'seedlet_get_the_archive_title' ) ) :
+	/**
+	 * Returns the archive page heading, allowing it to be filterable.
+	 */
+	function seedlet_get_the_archive_title( $title, $original_title, $prefix ) {
+		$prefix = '<span class="archive-prefix">' . $prefix . '</span>';
+		$title 	= '<span class="archive-title">' . $original_title . '</span>';
+
+		return '<h1 class="page-title">' . $prefix . $title . '</h1>';
+	}
+	add_filter( 'get_the_archive_title', 'seedlet_get_the_archive_title', 10, 3 );
+endif;