Bylines?

priestdi's picture

The easiest way to create a byline seems to be to simply default to the user tag, on the top of new stories. Name, date posted.

But there must be a more sophisticated way to accomplish this?

thanks ...

Comments

Use taxonomy

akoepke's picture

I would not use the user tag as the author for the following reasons

  1. The user posting the article may not always be the one who wrote it (eg. contributed article)
  2. It only allows for one person to be entered, you can't have multiple authors
  3. You can't specify someone who isn't a user on the system (eg. contributed article)
  4. The option to change the user is hidden down the bottom and can easily be missed/forgotten

I am working on a newspaper site at the moment and have added a taxonomy vocabulary called Authors which is linked to a byline field. This solves all the above issues and also allows you to retain the user field as a reference to the user who uploaded the article.

Exactly

yelvington's picture

We do it exactly as akoepke described. There is a vocabulary "authors" and a CCK field "byline2" (which is optional and intended for a title, such as "sports editor." Drupal's notion of "author" is ignored for presentation purposes.

The vocabulary is set to autocomplete, which helps ensure proper spelling.

Thanks!

priestdi's picture

.

we're stuck ....

priestdi's picture

Could you explain how to link the author vocab with the CCK field? And as a side note, how do you turn on the custom CCK field?

thanks!

nevermind!

priestdi's picture

It's working now. But thanks for all your help.

How, specifically, do we code for custom bylines?

brianestadt's picture

Hi everyone,

I, too, am hoping to tweak a Drupal 7 theme to feature a customized byline between the headline and body of nodes.

The problem is, I have no experience with php or theme customization. I can follow a tutorial, but it's just a case of "monkey see, monkey do" — there's no flash of understanding since I don't have a basic fluency in coding (it's my shame), so my ability to take a lesson from a similar problem and apply the solution to my situation is quite limited.

So, can someone show me (and everyone else who stumbles upon this page) how to do this?

I've set up a couple of taxonomy fields — "author" (field_author) and "staff_role" (field_staff_role) — and applied them to the appropriate content types. Now, what would I have to do have my site display a custom byline style for teasers and nodes that would display like this?

By John Doe | staff writer

Would anyone who has set up a similar custom byline style for their site care to post a step-by-step walkthru on how to do this?

Drupal Newspaper Bylines

Pica's picture

It is worth noting that on our Drupal newspaper www.TecumsehHerald.com the byline is actually a live link to other stories by the writer.
Surf New Media www.surfnewmedia.com has over 100 newspaper website clients with a number of examples of how to do what you're looking for both in Drupal 6 and D7. I'm partnered as a re-seller for them.
Rob Anfinson
Pica New Media

Simpler than expected!

dangswiss's picture

For me, after spending about an hour of scouring drupal.org and stackoverflow, and chopping up various different user-submitted fixes, the solution turned out to be a rather simple one. In your theme, add to template.php:

<?php
function yourthemename_preprocess_node(&$vars) {
 
$vars['submitted'] = t('By !username on !datetime', array('!username' => $vars['name'], '!datetime' => format_date($vars['node']->created, 'custom', 'F j, Y')));
}
?>

Obviously, if you already have a in your template.php file, just add the one line into the existing function. For the custom date format, use http://php.net/manual/function.date.php as a reference. I used 'F j, Y' to display it as "July 23, 2014."

--
Web Developer & Multi-Media Designer
http://gurtnerdesign.com

I highly recommend not using

pingers's picture

I highly recommend not using custom date formats (in format_date()).

Define a new format and type using the date module @ admin/config/regional/date-time. This way, you can easily change the date format in one place, which affects many places - instead of looking through code and updating date formats individually. These formats can also be exported to code.

Usage:

<?php
$date
= format_date($vars['node']->created, 'my_custom_format');
?>

See https://api.drupal.org/api/drupal/includes%21common.inc/function/format_...

Newspapers on Drupal

Group organizers

Group categories

Topics - Newspaper on Drupal

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week