I created a node--blog.tpl.php file and I styled the date of post to a custom style using the following

<?php if ($display_submitted): ?>
    <div class="dateblock">
      <footer class="month"><?php print $date_month ?></footer>
      <footer class="day"><?php print $date_day ?></footer>
      <footer class="year"><?php print $date_year ?></footer>
</div>
    <footer class="submitted<?php $user_picture ? print ' with-user-picture' : ''; ?>">
      <?php print $user_picture; ?>
     
    </footer>

but all I see is the date block that I created how can I add JUST the author name back in there? I tried something like

<div class="meta post-info">
<?php if ($submitted): ?>
<footer class="submitted">Posted by <?php print theme('username', $node) ?></footer>
  <?php endif; ?>

but its not working, does anyone have any idea what I need to change?

Comments

scampbell70’s picture

I got it a little closer I made the following change

But it prints out anonymous as the user name on everything

scampbell70’s picture

fixed it sorry for the un-needed post

Jeff Burnz’s picture

Status: Active » Fixed

Can you report back how you fixed this - it could be interesting for other users. Cheers.

scampbell70’s picture

Sorry I am not sure how to properly post code, so I hope this makes sense. To show only the author name and no date first turn off display author information in the content type. Then in the node.tpl.php file that you want to change find this line and edit whats below it

if ($display_submitted):

and change it to read


To customize the posted date and display author first turn off display author infomation in the content type then add the following to your template php file

function yourthemename_preprocess_node(&$vars) {
// Grab the node object.
$node = $vars['node'];
// Make individual variables for the parts of the date.
$vars['date_day'] = format_date($node->created, 'custom', 'j');r
$vars['date_month'] = format_date($node->created, 'custom', 'M');
$vars['date_year'] = format_date($node->created, 'custom', 'Y');
}

Then in the node.tpl.php file that you want to change find this line and edit whats below it

if ($display_submitted):

and change it to read

if ($display_submitted):

print $date_month
print $date_day
print $date_year

$user_picture ? print ' with-user-picture' : ''; ">
print $user_picture;


endif;

Then all you have to do is style it with css. Something like

div.dateblock {
background: none repeat scroll 0 0 #F3F3F3;
border-color: #EEEEEE #BBBBBB #BBBBBB #EEEEEE;
border-style: solid;
border-width: 1px;
color: #999999;
float: left;
font-family: Georgia,Arial,Verdana,sans;
line-height: 1;
margin: 6px 10px 0 8px;
text-align: center;
width: 40px;
}
div.dateblock footer {
display: block;
text-align: center;
}
div.dateblock footer.month {
background-color: #B5BEBE;
color: white;
font-size: 0.9em;
padding: 2px;
text-transform: uppercase;
}
div.dateblock footer.day {
font-size: 2em;
font-weight: bold;
}
div.dateblock footer.year {
font-size: 0.9em;
padding: 2px;
}

I hope this helps someone, it took me a few days of intense searching to peice it all together.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.