Skip to content

Instantly share code, notes, and snippets.

@Greg-Boggs
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Greg-Boggs/9102799 to your computer and use it in GitHub Desktop.
Save Greg-Boggs/9102799 to your computer and use it in GitHub Desktop.
Modify submitted by text in two different ways. The better way is in the preprocess function below.
<span class="submitted"><?php print $submitted?></span>
<?php if ($submitted) { ?>
<span class="submitted">
<?php
print 'by ' . theme('username', $node) . ' | ' . format_date($node->created, 'custom', 'd/m/Y');
if ($terms) {
print ' | in ';
}
?>
</span>
<?php } ?>
<?php
//template.php ways
function THEME_preprocess_node(&$vars) {
$vars['submitted'] = t('Posted by !username on !datetime',
array(
'!username' => $vars['name'],
'!datetime' => format_date($vars['created'], 'custom', 'd/m/y'),
));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment