Excerpt in homepage, category, tag and author pages for WordPress theme Twenty Thriteen

Posted on In QA

Excerpt in homepage, category, tag and author pages for WordPress theme Twenty Thriteen. Also add the “read more” link after the excerpt.

The patch:

diff --git a/wp-content/themes/twentythirteen/content.php b/wp-content/themes/twentythirteen/content.php
index 4f61b22..53b4686 100644
--- a/wp-content/themes/twentythirteen/content.php
+++ b/wp-content/themes/twentythirteen/content.php
@@ -30,7 +30,7 @@
 		</div><!-- .entry-meta -->
 	</header><!-- .entry-header -->
 
-	<?php if ( is_search() ) : // Only display Excerpts for Search ?>
+	<?php if ( is_search() || is_home() || is_category() || is_tag() || is_author() ) : // Only display Excerpts for Search ?>
 	<div class="entry-summary">
 		<?php the_excerpt(); ?>
 	</div><!-- .entry-summary -->
diff --git a/wp-content/themes/twentythirteen/functions.php b/wp-content/themes/twentythirteen/functions.php
index b4234bf..26d41f0 100644
--- a/wp-content/themes/twentythirteen/functions.php
+++ b/wp-content/themes/twentythirteen/functions.php
@@ -524,3 +524,14 @@ function twentythirteen_customize_preview_js() {
 	wp_enqueue_script( 'twentythirteen-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20130226', true );
 }
 add_action( 'customize_preview_init', 'twentythirteen_customize_preview_js' );
+
+
+/**
+ * Add read more to excerpts
+ */
+function new_excerpt_more( $more ) {
+    return '... <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">read more</a>';
+}
+add_filter( 'excerpt_more', 'new_excerpt_more' );
+
+
diff --git a/wp-content/themes/twentythirteen/style.css b/wp-content/themes/twentythirteen/style.css
index 60d0416..2917647 100644
--- a/wp-content/themes/twentythirteen/style.css
+++ b/wp-content/themes/twentythirteen/style.css
@@ -1,5 +1,5 @@
 /*
-Theme Name: Twenty Thirteen
+Theme Name: Twenty Thirteen - fclose
 Theme URI: http://wordpress.org/themes/twentythirteen
 Author: the WordPress team
 Author URI: http://wordpress.org/
@@ -3118,4 +3118,4 @@ footer.entry-meta {
 	.comment-reply-login {
 		color: #333;
 	}
-}
 No newline at end of file
+}

Leave a Reply

Your email address will not be published. Required fields are marked *