How to Customize your Thesis Byline

It’s very easy to customize your byline if you are using the thesis theme for wordpress. In case you didn’t know, the byline area is the one that says something like Posted by Author on DATE, just before your post title.

In this tutorial I’m going to show you how to create a custom byline that differs if it’s displayed on the front page or not. In particular I want to show the date only on the homepage, and not on the single article page.

It’s very simple to do this.

First, you need to remove the Show published-on date in post byline and Show author name in page byline options under byline options in your thesis configuration options area.

Second, you need to add a custom action on your custom_functions.php file. You can edit this file from the custom file editor inside wordpress if you want, but be sure you have FTP access before doing this, just in case you do something wrong. The following is the code you should put on your custom_functions file:

function add_to_byline() {
  if (is_front_page()) {
    echo ' on <abbr title="' . get_the_time('Y-m-d') . '">' . get_the_time(get_option('date_format')) . '</abbr>';
  }
}
add_action('thesis_hook_byline_item', 'add_to_byline', '99');

And Voila! You are now displaying the date only in the front page.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>