How to change the output of the $submitted values of a node

Drupal Version

By default, if you have a content type's "Display author and date information" turned on then Drupal will output something similar to the following when viewing a node:

Submitted by John Smith on Sat, 11/15/2014 - 18:15

However, there may be times when you'll want to change the default output structure to, perhaps, display only the author or only the date. Or, you may want to change the display the format of the date output. As is usually the case with Drupal, there are multiple ways to achieve this. In this case we're going to modify the node.tpl.php file.

The output of a node is handled by the theme file named node.tpl.php. This file should be located in your active theme's folder. If this file is not there then copy it from the core Drupal node folder located at /modules/node/node.tpl.php - simply copy the node.tpl.php file from there into your theme folder. Then clear the Drupal caches so Drupal will use this new node theme file.

Now edit the node.tpl.php template file and look for the section that handles the 'submitted' information. It should look something like:

<?php if ($display_submitted): ?>
    <div class="submitted">
      <?php print $submitted; ?>
  <?php endif; ?>

The following line is what actually prints the default 'submitted by' output and this is what you'll need to change.

<?php print $submitted; ?>


For example, changing it to the following:

<?php if ($display_submitted): ?>
        <p class="submitted">         
          <?php print  date( "F j, Y",$node->created); ?>
<?php endif; ?>

Will now output something like:

November 16, 2014

Since the entire $node object is available in this theme file you'll now have a lot of flexibility to change the 'submitted by' output.


Modifying the node.tpl.php template file will affect all nodes. If you want to target specific nodes of a specific content type then then create a new, special node template file for that content type using the following format:


Theme hook suggestions are made based on these factors, listed from the most specific template to the least. Drupal will use the most specific template it finds:

  • node--nodeid.tpl.php
  • node--type.tpl.php
  • node.tpl.php

For example, if your content type machine name is called articles then create a new template file in your active theme folder called node--articles.tpl.php then clear the caches.

Another example with a content type that has multiple words in its name:

Content Type machine name: photo_gallery
Node Template file name: node--photo-gallery.tpl.php

Find more info on

Author Information

Written by: Shawn Ostermann

Shawn is a Drupal Specialists with over 12 years of experiencing building and developing Drupal websites including custom module development and e-commerce websites.