This document is deprecated! The information on this page refers to a Thesis version that is now obsolete. Please visit the Thesis Docs for current documentation.
Thesis offers several options for controlling the information which displays in your byline. To view and/or change these options, navigate to Design Options, then look under Display Options : Bylines.
In some cases, you may need to use custom functions to achieve the results you want. Here are some examples of how to make changes to the byline, using both the standard options and custom functions.
Hide Number of Comments ∞
In the Design Options panel, under Display Options : Bylines, uncheck the “Show number of comments in byline” option.
Hide Post Categories ∞
In the Design Options panel, under Display Options : Bylines, uncheck the “Show post categories” option.
Move Post Categories to First Line ∞
In the Design Options panel, under Display Options : Bylines, uncheck the “Show post categories” option. Then, place this code in custom_functions.php
:
function add_to_byline() { if (!is_page()) echo ' in <span>' . get_the_category_list(',') . '</span>'; } add_action('thesis_hook_byline_item', 'add_to_byline', '99');
Move Entire Byline to After Post ∞
In the Design Options panel, under Display Options : Bylines, uncheck all options. Then, place this code in custom_functions.php
:
function custom_byline() { ?> <p class="headline_meta"><?php thesis_author(); ?> on <abbr class="published" title="<?php echo get_the_time('Y-m-d'); ?>"><?php echo get_the_time(get_option('date_format')); ?></abbr> · <span><a href="<?php the_permalink(); ?>#comments" rel="nofollow"> <?php comments_number(__('0 comments', 'thesis'), __('1 comment', 'thesis'), __('% comments', 'thesis')); ?></a></span></p> <p class="headline_meta"><?php the_tags('tagged as <span>', ', ', '</span>'); ?> in <span><?php echo get_the_category_list(','); ?></span></p> <?php } add_action('thesis_hook_after_post', 'custom_byline');
Add “Posted In” Before Category ∞
In the Design Options panel, under Display Options : Bylines, uncheck the “Show post categories” option. Then, place this code in custom_functions.php
:
function add_to_byline() { ?> </p><p class="headline_meta"><?php echo __('Posted in:', 'thesis') . ' <span>' . get_the_category_list(',') . '</span>'; ?> <?php } add_action('thesis_hook_byline_item', 'add_to_byline', '99');
Add Time Stamp After Published On Date ∞
In the Design Options panel, under Display Options : Bylines, uncheck the “Show published-on date in post byline” and “Show number of comments in byline” options. Then, place this code in custom_functions.php
:
function custom_byline() { if (!is_page()) { ?> <p class="headline_meta"><abbr class="published" title="<?php echo get_the_time('Y-m-d H:i'); ?>"><?php echo get_the_time(get_option('date_format')); ?> <?php the_time('G:i a'); ?></abbr> · <span><a href="<?php the_permalink(); ?>#comments" rel="nofollow"> <?php comments_number(__('0 comments', 'thesis'), __('1 comment', 'thesis'), __('% comments', 'thesis')); ?></a></span></p> <?php } } add_action('thesis_hook_after_headline', 'custom_byline');
Note: This code excludes Pages from having the custom byline applied; you will need to remove the extra conditional code if you wish to use it on Pages as well.
Move Date to Before Title ∞
In the Design Options panel, under Display Options : Bylines, uncheck the “Show published-on date in post byline” and “Show published-on date in page byline” options. Then, place this code in custom_functions.php
:
function add_to_byline() { ?> <p class="headline_meta"><?php echo (''). ' <span>' .get_the_time('F j, Y') . '</span></p>'; ?> <?php } add_action('thesis_hook_before_headline', 'add_to_byline', '1');
Display an Avatar Next to Byline ∞
Place this code in custom_functions.php
(replacing http://www.example.com/path/to/your/images/avatar.gif
with the URL to your avatar):
/* byline avatar */ function byline_avatar() { echo '<img class="byline_avatar" src="http://www.example.com/path/to/your/images/avatar.gif" />'; } add_action('thesis_hook_before_headline', 'byline_avatar');
Then, place this code in custom.css
(adjust margin value as desired):
/*avatar styles*/ .custom .byline_avatar { float: left; margin-right: 0.5em; margin-bottom: 0.5em; }
Avatars for Multiple Authors ∞
Place this code in custom_functions.php
(replace 50
with the desired pixel size):
/* byline avatars */ function byline_avatars() { echo get_avatar(get_the_author_id(), 50); } add_action('thesis_hook_before_headline', 'byline_avatars');
Then, place this code in custom.css
(adjust margin value as desired):
/*avatar styles*/ .custom .avatar { float: left; margin-right: 0.5em; margin-bottom: 0.5em; }
Hide Byline on Archives & Category Pages Only ∞
Place this code in custom_functions.php
:
function custom_body_class($classes) { if (is_archive() || is_category()) { $classes[] .= 'hide_meta'; } return $classes; } add_filter('thesis_body_classes', 'custom_body_class');
Then, place this code in custom.css
:
/* hide meta */ .custom.hide-meta .headline_meta {display:none;}
Related Resources:
thesis_hook_byline_item
- WordPress conditional tags
- Date formats reference – PHP Manual