Drupal core themes the author name and published date in theme_preprocess_node() and makes it available as the $submitted variable. I think that Omega should follow this behavior and simply print the $submitted variable in node.tpl.php instead of ignoring it and re-theming the output.

Currently in Omega 3.1 node.tpl.php:

<?php if ($display_submitted): ?>
<footer class="submitted"><?php print $date; ?> -- <?php print $name; ?></footer>
<?php endif; ?>

It seem silly to have to override the node.tpl.php file just to update the author and publishing info formatting.

Can Omega not implement theme_preprocess_node() to implement any customization over core?

I can roll a patch if y'all think this is the right way of doing things.

Comments

star-szr’s picture

+1 from me. Shouldn't be hardcoded in node.tpl.php.

jessehs’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new1.04 KB

Here's a patch. Please test. (I patched using patch -p1 command.)

star-szr’s picture

Status: Needs review » Needs work

Funny, I wrote almost the exact same code earlier in my subtheme, foo and all.

+++ b/omega/template.phpundefined
@@ -145,6 +145,11 @@ function omega_alpha_preprocess_node(&$vars) {
+    $vars['submitted'] = $vars['date'] . ' -- ' . $vars['name']  . 'foo';

Lose the foo :)

+++ b/omega/templates/node.tpl.phpundefined
@@ -7,8 +7,8 @@
+  <?php if ($display_submitted && $submitted): ?>

I used this condition as well, because I wanted to hide the submitted date from my teasers.

Once the foo is gone this gets my recommendation.

marcoka’s picture

Assigned: Unassigned » himerus
jessehs’s picture

StatusFileSize
new1.03 KB

Ha ha! Whoops!

Here you go.

jessehs’s picture

Status: Needs work » Needs review
datagroove_’s picture

+1
question though, the $date var is a string, how do we edit the strings format?

jessehs’s picture

@datagroove_, I believe that the default $date variable is set by setting the Medium date format at the Date and time config page (path is /admin/config/regional/date-time in Drupal 7).

osopolar’s picture

Status: Needs review » Needs work

This also affects the comment template (comment.tpl.php). Both should be done the same way.

kerasai’s picture

Wow, please get this commited. Super simple issue but this is non-standard and it took me quite some time to unravel what was going on here.

steinmb’s picture

Assigned: himerus » Unassigned
Issue summary: View changes