Fixing The Twentythirteen WordPress Theme

By default the twentythirteen theme that comes bundled with WordPress is a great looking theme. It uses modern fonts and large orange coloured graphical accents.

Another benefit of using this standard theme is that you can be sure that a lot of work has been put into it – the WordPress brand depends on it!

Still I believe it has a few drawbacks for most : the comments feed is broken and it does not honour the setting to show summaries of posts on the frontpage instead of full posts. In this article I will fix both, it is really quite easy.

First of all the comments feed will actually return xml but it will do so with a 404 not found http response code which will cause the Google crawler to report it as a broken link on each and every page. This is not good for SEO. Fixing it involves hooking the feed_link action and return false if it is the comments-link :

add_action( 'feed_link', 'remove_comments_feed', 10, 2 );
function remove_comments_feed( $output, $feed ) {
  if ( strpos( $output, 'comments' ) > 0 )
    return;
  return $output;
}

This is simply added to the functions.php file of the theme (“wp-content/themes/twentythirteen/functions.php”).

Next we modify the summary-generation in the content.php file. You should look for the hardcoded if statement :

<?php if ( is_search() ) : // Only display Excerpts for Search ?>

it is line 33 in the file. You then force it to summarize for all the standard multiple-post views by changing it to :

<?php if ( is_search() || is_author() || is_tag()
       || is_archive() || is_home () ) : ?>

and you are good to go!

1 Comment

  1. Thanks for the tip, I was wondering why my blogs comment feeds is not working. Thanks for solving the issue

Leave a Comment