How to Filter the Byline in Genesis

By default genesis post info includes the date the article was posted, an author link and comments. However every blog may have a different need of exactly what they want displayed here.

Some may not even want any of this information displayed. To remove the byline in genesis add the following code to your child’s theme functions.php

remove_action('genesis_before_post_content', 'genesis_post_info');

However, if you do want want a byline on your site but just want to change exactly what is displayed or in what order it shown, there is a filter available.

add_filter('genesis_post_info', 'custom_post_info');
function custom_post_info($post_info) {
     $post_info =  __('By', 'genesis') . ' [post_author_posts_link] ' . __('on', 'genesis') . ' [post_date] [post_comments] [post_edit]';
     return $post_info;

The code above will change the output from the default byline:

by 22 Comments


By on 22 Comments


  1. says

    Crikey – I added the html above to my Focus functions.php and got an error message:
    “Parse error: syntax error, unexpected $end in /home/emotmnet/public_html/wp-content/themes/focus/functions.php on line 50”
    Now I’m locked out of my site as each time I login I get the same message above.
    Have I ruined my site? Do I need to start over?
    This is what I added:
    add_filter(‘genesis_post_info’, ‘custom_post_info’);
    function custom_post_info($post_info) {
    $post_info = __(‘By’, ‘genesis’) . ‘ [post_author_posts_link] ‘ . __(‘on’, ‘genesis’) . ‘ [post_date] [post_comments] [post_edit]‘;
    return $post_info;

    • says

      All good. I have restored my site by some ftp magic and Filezilla. I realize now that I inserted a piece of code for the Genesis theme into my Genesis Child Focus theme – it didn’t work!
      Can you please advise my the code to insert into my Focus theme functions.php that will remove the date from my Focus theme?

      • Profile photo of Christopher says

        You would want to make sure it’s after a “< ?php" but before a "?>“. They tell when php code starts and end so the server can process it correctly. Place it at the bottom of your child themes functions.php before the “?>” if there is one; if not you can still put it at the end. If would like help, if you could use to post the contents of your functions.php I can show you exactly where to put it.

          • says

            Hi Christopher,

            Not sure why you have not answered my post. You say, “Place it at the bottom of your child themes functions.php before the “?>” if there is one; if not you can still put it at the end.”
            My Focus theme functions.php does not have “?>” at the end.
            I added the script as you suggested days ago and the site froze up, which resulted in my post above.
            Am I missing something here? Am I required to pay a fee to get my script altered which I pasted at
            Sorry, I just don’t get why you have replied to other posts here and not mine.
            Please advise.

          • Profile photo of Christopher says

            Try this, *Edit: *

            Sorry for not answering sooner, work got too crazy the other day and just started going back through my comments responding to any I missed.

            I found the issue. There were fancy quotes in the snippet. I have updated the code in the link above and should work correctly now.

            • says

              OK Christopher, Understand. Thanks for coming back to me on this. I’ve now added the following code to elminate the date and all is ok!

              add_filter(‘genesis_post_info’, ‘custom_post_info’);
              function custom_post_info($post_info) {
              $post_info = __(‘By’, ‘genesis’) . ‘ [post_author_posts_link] ‘ . ‘ [post_comments] [post_edit]‘;
              return $post_info;

  2. says

    I’m trying to remove the byline (author name and date) at the beginning of the post. So could I just paste this into simple hooks? remove_action(‘genesis_before_post_content’, ‘genesis_post_info’);
    If yes, where in simple hooks?

    • Profile photo of Christopher says

      This code is actually for the child themes function.php file. With simple hooks you can simply check a box labeled “Unhook genesis_post_info() function from this hook?” The plug-in allows easy removal of a lot of functions that have been put in through hooks.

      • says

        Thanks. I found the box and checked it. But I still have the post date and author name above the blog post. Sorry for any trouble here. I thought I was a savvy gal. Is simple edits and easier place to do this?

  3. says

    I’m trying to change the byline in my copyblogger theme and add some social media share buttons to the right side where the comments link is now I copied the add_filter code above to the copyblogger functions file, but nothing is changing.

    Right now my byline looks like this:
    March 30, 2012 By Andrew Leave a Comment

    But I’d like it to look like this:
    March 30, 2012 By Andrew – Leave a Comment Facebook – Twitter share buttons

      • says

        I’m confused now, because I’ve tried altering the $post_info part of my functions file, but nothing is changing on my site. The variables also don’t seem to match what’s currently being displayed.

        Here’s what in the function file:
        $post_info = ‘by [post_author_posts_link] on [post_date] [post_comments] [post_edit]‘;

        But as I said earlier my byline looks like this:
        March 30, 2012 By Andrew Leave a Comment

        Is it possible the byline is being set somewhere else in the copyblogger template?

        • Profile photo of Christopher says

          It may be possible that it is being modified by a plugin. Try removing it all together with

           if it doesn't remove it means it has been removed and modified from somewhere else. If you are running any genesis specific plugins I would check those files for "genesis_post_info". If it does get removed try setting a priority on the filter like [php]add_filter('genesis_post_info', 'custom_post_info', 20 );

          the 20 will make the filter run later, can even set it at 100 to make sure it runs after all other modifications to the post info.

          • says

            I found it. It’s in Genesis Simple Edits. Do you know if it’s possible to add facebook or twitter share buttons there? I started thinking about putting them in the byline when I was looking at the the Visual Hook Guide, because it has a twitter link on the right side of the byline.

            • Profile photo of Christopher says

              For the twitter button I actually ended up creating a twitter plugin that displays the button with a shortcode and added that post info filter. Could do something simliar. I have a tutorial in draft that is over a year old. Maybe I should dust that off. Definitely possible though.

Leave a Reply

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