How to display the page name/title as an H1 heading
PermalinkBasically the equivalent of <?php the_title(); ?> in WordPress.
If this is a dumb question I apologize... seems utterly basic and I'm sure it's super-simple, but I just can't seem to figure it out...
Thanks.
dustin
I did find a solution, just a moment ago, here:http://www.concrete5.org/community/forums/customizing_c5/page_title...
It's only slightly different from yours, but this code snippet will display the meta title if there is one, otherwise display the "collectionName" which is equivalent to the page title:
Am I the only one who finds it odd that the page name isn't displayed on the page as an H1 by default?? Ah well.
You could potentially step on your toes down the road, so if having two different page names is necessary then I'd suggest making a new page attribute and use that as an override.
<?php $strName = trim($c->getAttribute('override_page_attribute')); if(strlen($strName) == 0) $strName = $c->getCollectionName(); ?> <h1><?php echo htmlspecialchars($strName), ENT_QUOTES, 'UTF-8'); ?></h1>
For what I need your code works perfectly, so I'll just stick with that instead.
You could theorectially place this in the SITE_ROOT/themes/yourthemefolder/elements/header.php file, but then it would appear in system pages and the home page. Keeping it in your template files gives you a bit more control.