Remove “by author” post section from Genesis themes

As I already wrote in How-to remove the author from your Twenty-Ten posts most blogs do not need the section “by author” since there is only one author.
By default most Genesis themes contain this section (e.g. the prose theme):

Let’s see how-to remove the author’s name from the post info.

The post info is produced by this function:

function genesis_post_info() {
  global $post;
 
  if ( is_page( $post->ID ) )
    return; // don't do post-info on pages
 
  $post_info = '[post_date] ' . __('By', 'genesis') . 
               ' [post_author_posts_link] [post_comments] [post_edit]';
 
  printf( '<div class="post-info">%s</div>', apply_filters('genesis_post_info',
          $post_info) );
}

As you see the function calls a filter for the string $post_info which contains the shortcodes for the post info. So it’s easy to define a function which removes the “__('By', 'genesis') . ' [post_author_posts_link]” code:

add_filter('genesis_post_info', 'my_post_info');
function my_post_info() {
	$post_info = '[post_date] [post_comments] [post_edit]';
  return $post_info;
}

If you put the code in the functions.php of your Genesis child theme the output looks something like this:

This is all you need if you’re your blog’s only author.

No related posts.

Comments

  1. Ari Wahyudi says:

    Great post, Latz. I’ve been looking for this tips for quite some time.

    Another question: I want to insert image navigation (Previous Image/Next Image) in my gallery attachment page, but I can’t find out how. Can you help me with this?

    this is the link:
    http://ariwahyudi.web.id/2012/04/operation-travel-pulau-kumala-tenggarong/buah-bolok-khas-kutai/

  2. Alex Fit says:

    Thanks for this post… It is really helpful….

Speak Your Mind

*