I was wondering if it is possible to make it optional for a site admin to display the title of page content. Sometimes maybe they don't want a title of there content to show on the pages where they are posted. I have looked into Autonode, but it does not perform the actions that I need. To clear it up, I just want the option to be able to show a title or not when entering new content or editing it.

Comments

WorldFallz’s picture

You could probably do this by adding a cck field to node (checkbox or select list yes/no) and then add some code to the node.tpl.php or template.php file to check that value of that field before printing/setting the $title.

Melcore’s picture

I was wondering if some could possible explain in some sort of detail how to do that

WorldFallz’s picture

The easiest way would probably be:

  1. Add a field named something like field_showtitle to the content type (i'll assume a select list yes/no field).
  2. In the node.tpl.php file do something like:
    <?php if ($node->field_showtitle[0][value] == 'yes'): ?>
      <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
    <?php endif; ?>
    
Melcore’s picture

Thank You