Community Documentation

How to add "submitted date" to only 'child pages' of a 'book'

Last updated October 18, 2011. Created by Sree on February 20, 2007.
Edited by MGParisi, ronald_istos. Log in to edit this page.

Here's a way to add "submitted date" to only child pages but not in the main book page!

<?php if ($submitted) { ?>
<span class="submitted">
<?php  if ($node->type == 'book') { 
    if (
$node->parent != 0) {
print 
format_date($node->created, 'custom', "F jS, Y") ;}
}
?>

</span>
<?php } ?>

Add this code in the node.tpl.php file

About this page

Drupal version
Drupal 4.7.x
Audience
Themers

Archive

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.