Customise "submitted by" information based on node type
Last modified: February 21, 2008 - 12:22
description
You can display different author information and still respect the global "display post information" settings.
In this example I wanted flexinode-2 items to be displayed with the usual submission info, but have every other type respect the "display post information" setting.
Note that the content type I created, "news", goes by its flexinode name, and not by what I named it. Here is an example snippet for a node.tpl.php:
<?php if (theme_get_setting('toggle_node_info_' . $node->type)) : ?>
<?php if ($node->type == 'flexinode-2'):?>
<div class="info"><?php print $submitted; ?></div>
<?php elseif($node->type): ?>
<div class="info"> by <?php print $name; ?></div>
<?php endif; ?>
<?php endif; ?>For my settings this displays:
NEWS NODE TITLE HERE
submitted by me on Tue, 04/26/2005 - 10:55am.
STORY NODE TITLE HERE
by me
PAGE NODE TITLE HERE
because I have set news and story nodes to display the submitted info while page is set to display no submission info at all.

Here's another way
<?php if ($submitted) { ?><span class="submitted">
<?php if ($node->type == 'blog') {
print 'Posted ' . format_date($node->created, 'custom', "F jS, Y") . ' by ' . theme('username', $node);
}
else {
print 'By ' . theme('username', $node) . ' <br /> ' . format_date($node->created, 'custom', "F jS, Y") ;
}
?>
</span>
<?php } ?>
Here's what this displays:
BLOG NODE TITLE HERE
Posted October 14, 2006 by me
NEWS NODE TITLE HERE
By Me
October 14, 2006
And to have a page node type with just the title (no "submitted by"), go to themes > configure > global settings to turn off (uncheck) the "submitted by" for 'page'.