Posted by priestdi on March 9, 2011 at 12:44am
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
I would not use the user tag as the author for the following reasons
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
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!
.
we're stuck ....
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!
It's working now. But thanks for all your help.
How, specifically, do we code for custom bylines?
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 Bylines
Are you looking for something like this? These are all drupal
www.addisonindependent.com
http://tecumsehherald.com/content/tecumseh-school-board-draws-limited-in...
http://engineering.stanford.edu/award/bioengineer-quake-receives-2013-na...
Drupal Newspaper Bylines
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!
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
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_...